pg_dump: Fix minor memory leak
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 23 Jan 2017 13:28:39 +0000 (08:28 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 23 Jan 2017 13:28:39 +0000 (08:28 -0500)
Missing a destroyPQExpBuffer() in the early exit branch.  The early
exits aren't really necessary.  Most similar functions just proceed
running the rest of the code zero times and clean up at the end.

src/bin/pg_dump/pg_dump.c

index 6cbefac250f412635dcf281da1ca760d8c9cfbd2..049c9cdfd7e168f440fbd9b81499daf81f7c40a7 100644 (file)
@@ -3360,15 +3360,6 @@ getPublications(Archive *fout)
 
        ntups = PQntuples(res);
 
-       if (ntups == 0)
-       {
-               /*
-                * There are no publications defined. Clean up and return.
-                */
-               PQclear(res);
-               return;
-       }
-
        i_tableoid = PQfnumber(res, "tableoid");
        i_oid = PQfnumber(res, "oid");
        i_pubname = PQfnumber(res, "pubname");
@@ -3637,15 +3628,6 @@ getSubscriptions(Archive *fout)
 
        ntups = PQntuples(res);
 
-       if (ntups == 0)
-       {
-               /*
-                * There are no subscriptions defined. Clean up and return.
-                */
-               PQclear(res);
-               return;
-       }
-
        i_tableoid = PQfnumber(res, "tableoid");
        i_oid = PQfnumber(res, "oid");
        i_subname = PQfnumber(res, "subname");