mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
inpcom.c, inp_expand_macro_in_str(), remove a memory leak
This commit is contained in:
@@ -3036,7 +3036,7 @@ inp_expand_macro_in_str(struct function_env *env, char *str)
|
|||||||
char *c;
|
char *c;
|
||||||
char *open_paren_ptr, *close_paren_ptr, *fcn_name, *params[1000];
|
char *open_paren_ptr, *close_paren_ptr, *fcn_name, *params[1000];
|
||||||
char *curr_ptr, *macro_str, *curr_str = NULL;
|
char *curr_ptr, *macro_str, *curr_str = NULL;
|
||||||
int num_parens, num_params;
|
int num_parens, num_params, i;
|
||||||
char *orig_ptr = str, *search_ptr = str, *orig_str = strdup(str);
|
char *orig_ptr = str, *search_ptr = str, *orig_str = strdup(str);
|
||||||
char keep;
|
char keep;
|
||||||
|
|
||||||
@@ -3132,6 +3132,9 @@ inp_expand_macro_in_str(struct function_env *env, char *str)
|
|||||||
tfree(macro_str);
|
tfree(macro_str);
|
||||||
|
|
||||||
search_ptr = str = close_paren_ptr + 1;
|
search_ptr = str = close_paren_ptr + 1;
|
||||||
|
|
||||||
|
for (i = 0; i < num_params; i++)
|
||||||
|
tfree(params[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_str == NULL) {
|
if (curr_str == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user