summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/variable.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2015-06-12 14:52:55 +0200
committerMichael Meskes <meskes@postgresql.org>2015-06-13 11:14:07 +0200
commitec311b1d8f2062d600201c846f817a80eadca6ca (patch)
treeeb05f414206e17c6611db126b489adcc724c08cc /src/interfaces/ecpg/preproc/variable.c
parent1ea539ae3fc197e6512e09609229a2bad8f3001d (diff)
Fixed some memory leaks in ECPG.
Patch by Michael Paquier Conflicts: src/interfaces/ecpg/preproc/variable.c
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r--src/interfaces/ecpg/preproc/variable.c8
1 files changed, 7 insertions, 1 deletions
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