... | ... |
@@ -150,7 +150,12 @@ int cli_parse_add(struct cli_matcher *root, const char *virname, const char *hex |
150 | 150 |
pt->length = root->ac_mindepth; |
151 | 151 |
/* dummy */ |
152 | 152 |
pt->pattern = mpool_calloc(root->mempool, pt->length, sizeof(*pt->pattern)); |
153 |
+ if (pt->pattern) { |
|
154 |
+ free(pt); |
|
155 |
+ return CL_EMEM; |
|
156 |
+ } |
|
153 | 157 |
if ((ret = cli_ac_addpatt(root, pt))) { |
158 |
+ mpool_free(root->mempool, pt->pattern); |
|
154 | 159 |
free(pt); |
155 | 160 |
return ret; |
156 | 161 |
} |