From ec311b1d8f2062d600201c846f817a80eadca6ca Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 12 Jun 2015 14:52:55 +0200 Subject: Fixed some memory leaks in ECPG. Patch by Michael Paquier Conflicts: src/interfaces/ecpg/preproc/variable.c --- src/interfaces/ecpg/preproc/variable.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/interfaces/ecpg/preproc/variable.c') diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 6ff574bbd92..1b181b9dd41 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -437,9 +437,13 @@ remove_variable_from_list(struct arguments ** list, struct variable * var) void dump_variables(struct arguments * list, int mode) { + char *str_zero; + if (list == NULL) return; + str_zero = mm_strdup("0"); + /* * The list is build up from the beginning so lets first dump the end of * the list: @@ -450,11 +454,13 @@ dump_variables(struct arguments * list, int mode) /* Then the current element and its indicator */ ECPGdump_a_type(yyout, list->variable->name, list->variable->type, list->variable->brace_level, list->indicator->name, list->indicator->type, list->indicator->brace_level, - NULL, NULL, mm_strdup("0"), NULL, NULL); + NULL, NULL, str_zero, NULL, NULL); /* Then release the list element. */ if (mode != 0) free(list); + + free(str_zero); } void -- cgit v1.2.3