]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix double frees in ecpg.
authorMichael Meskes <meskes@postgresql.org>
Tue, 13 Mar 2018 23:47:49 +0000 (00:47 +0100)
committerMichael Meskes <meskes@postgresql.org>
Tue, 13 Mar 2018 23:52:21 +0000 (00:52 +0100)
Patch by Patrick Krecker <patrick@judicata.com>

src/interfaces/ecpg/preproc/ecpg.c

index 96a502a6447e4acec1b928b6657539d9913b5a10..9741cd03e885f7b921a5b03bb50ca09f893e8da6 100644 (file)
@@ -327,6 +327,7 @@ main(int argc, char *const argv[])
                                                fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
                                                                progname, output_filename, strerror(errno));
                                                free(output_filename);
+                                               output_filename = NULL;
                                                free(input_filename);
                                                continue;
                                        }
@@ -474,8 +475,10 @@ main(int argc, char *const argv[])
                                }
                        }
 
-                       if (output_filename && out_option == 0)
+                       if (output_filename && out_option == 0) {
                                free(output_filename);
+                               output_filename = NULL;
+                       }
 
                        free(input_filename);
                }