check the pointer returns from zmalloc

This commit is contained in:
c9s 2014-06-01 01:25:34 +08:00
parent a19d2377cc
commit 188a687150

View file

@ -15,6 +15,8 @@
str_array * str_array_create(int cap) {
str_array * list = (str_array*) zmalloc( sizeof(str_array) );
if (!list)
return NULL;
list->len = 0;
list->cap = cap;
list->tokens = (char**) zmalloc( sizeof(char*) * cap);