Commit f4cbbe70 authored by Lev Walkin's avatar Lev Walkin

safety fix

parent 993eca85
......@@ -93,17 +93,17 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) {
if(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) free(storage);
storage = malloc(size + 1);
if(storage) {
storage_size = size + 1;
} else {
storage_size = 0;
return NULL;
}
char *tmp = malloc(size + 1);
if(tmp) {
free(storage);
storage = tmp;
storage_size = size + 1;
} else {
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