]> granicus.if.org Git - postgresql/commitdiff
Fix minor leak in pg_dump
authorStephen Frost <sfrost@snowman.net>
Sun, 26 Jan 2014 22:58:48 +0000 (17:58 -0500)
committerStephen Frost <sfrost@snowman.net>
Sun, 26 Jan 2014 22:58:48 +0000 (17:58 -0500)
Move allocation to after we check the remote server version, to avoid
a possible, very minor, memory leak.  This makes us more consistent
throughout as most places in pg_dump are done in the same way (due, in
part, to previous fixes like this).

Spotted by the Coverity scanner.

src/bin/pg_dump/pg_dump.c

index 3862f05fb086ede3b8b00d444f5df64ae401b08c..ebbb5b730c3c9a2bd087c6cae4a5b74b47be801a 100644 (file)
@@ -3602,7 +3602,7 @@ getConversions(Archive *fout, int *numConversions)
        PGresult   *res;
        int                     ntups;
        int                     i;
-       PQExpBuffer query = createPQExpBuffer();
+       PQExpBuffer query;
        ConvInfo   *convinfo;
        int                     i_tableoid;
        int                     i_oid;
@@ -3617,6 +3617,8 @@ getConversions(Archive *fout, int *numConversions)
                return NULL;
        }
 
+       query = createPQExpBuffer();
+
        /*
         * find all conversions, including builtin conversions; we filter out
         * system-defined conversions at dump-out time.