diff options
author | Michael Meskes <meskes@postgresql.org> | 2015-06-12 14:52:55 +0200 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2015-06-13 11:17:42 +0200 |
commit | a5238ced6789191c24d4979fdd06dd8d4412f72c (patch) | |
tree | 5141ef47d03d53047b98e412e1cf2b396f019fdf /src/interfaces/ecpg/preproc/variable.c | |
parent | 866e7f591550929991d1cc683c4a3faa74263036 (diff) | |
download | postgresql-a5238ced6789191c24d4979fdd06dd8d4412f72c.tar.gz postgresql-a5238ced6789191c24d4979fdd06dd8d4412f72c.zip |
Fixed some memory leaks in ECPG.
Patch by Michael Paquier
Conflicts:
src/interfaces/ecpg/preproc/variable.c
src/interfaces/ecpg/preproc/pgc.l
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/variable.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index c4ccabd2a69..2a39d7f7e76 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 |