Handle the case of resize to 0 and realloc that returns NULL.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20561 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-04-24 16:14:30 +00:00
parent eef3eb8586
commit 99212e8b87

View File

@@ -111,7 +111,7 @@ generate_type_seq (const Symbol *s)
"\t\tsizeof(data->val[0]) * data->len);\n"
/* resize but don't care about failures since it doesn't matter */
"ptr = realloc(data->val, data->len * sizeof(data->val[0]));\n"
"if (ptr) data->val = ptr;\n"
"if (ptr != NULL || data->len == 0) data->val = ptr;\n"
"return 0;\n",
subname);