Commit f4cbbe70 authored by Lev Walkin's avatar Lev Walkin

safety fix

parent 993eca85
...@@ -93,15 +93,15 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { ...@@ -93,15 +93,15 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) {
if(prefix) if(prefix)
size += 1 + strlen(prefix); size += 1 + strlen(prefix);
/* /*
* Make sure we have this amount of storage. * Make sure we have the required amount of storage.
*/ */
if(storage_size <= size) { if(storage_size <= size) {
if(storage) free(storage); char *tmp = malloc(size + 1);
storage = malloc(size + 1); if(tmp) {
if(storage) { free(storage);
storage = tmp;
storage_size = size + 1; storage_size = size + 1;
} else { } else {
storage_size = 0;
return NULL; return NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment