]> granicus.if.org Git - postgresql/commitdiff
vacuumlo: Avoid unlikely memory leak.
authorRobert Haas <rhaas@postgresql.org>
Wed, 14 Jan 2015 20:14:20 +0000 (15:14 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 14 Jan 2015 20:14:20 +0000 (15:14 -0500)
Spotted by Coverity.  This isn't likely to matter in practice, but
there's no harm in fixing it.

Michael Paquier

contrib/vacuumlo/vacuumlo.c

index 43130dca8afcf181a990dd1bdfe260896c2d3fa8..ca0d3048b82a201290f83c19113931e0a5765248 100644 (file)
@@ -240,6 +240,12 @@ vacuumlo(const char *database, const struct _param * param)
                        fprintf(stderr, "Out of memory\n");
                        PQclear(res);
                        PQfinish(conn);
+                       if (schema != NULL)
+                               PQfreemem(schema);
+                       if (schema != NULL)
+                               PQfreemem(table);
+                       if (schema != NULL)
+                               PQfreemem(field);
                        return -1;
                }
 
@@ -256,6 +262,9 @@ vacuumlo(const char *database, const struct _param * param)
                        PQclear(res2);
                        PQclear(res);
                        PQfinish(conn);
+                       PQfreemem(schema);
+                       PQfreemem(table);
+                       PQfreemem(field);
                        return -1;
                }
                PQclear(res2);