its ok to return NULL if we are allocating zero elements
This commit is contained in:
@@ -630,7 +630,7 @@ decode_type (const char *name, const Type *t, int optional,
|
|||||||
fprintf(codefile,
|
fprintf(codefile,
|
||||||
"else {\n"
|
"else {\n"
|
||||||
"(%s)->u.%s.data = calloc(1, len);\n"
|
"(%s)->u.%s.data = calloc(1, len);\n"
|
||||||
"if ((%s)->u.%s.data == NULL) {\n"
|
"if ((%s)->u.%s.data == NULL && len != 0) {\n"
|
||||||
"e = ENOMEM; %s;\n"
|
"e = ENOMEM; %s;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"(%s)->u.%s.length = len;\n"
|
"(%s)->u.%s.length = len;\n"
|
||||||
|
Reference in New Issue
Block a user