Skip to content

Commit 77b68e3

Browse files
committed
Fix copy-pasto in freeing memory on error in vacuumlo.
It's harmless to call PQfreemem() with a NULL argument, so the only consequence was that if allocating 'schema' failed, but allocating 'table' or 'field' succeeded, we would leak a bit of memory. That's highly unlikely to happen, so this is just academical, but let's get it right. Per bug #15838 from Timur Birsh. Backpatch back to 9.5, where the PQfreemem() calls were introduced. Discussion: https://www.postgresql.org/message-id/[email protected]
1 parent a36c84c commit 77b68e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/vacuumlo/vacuumlo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ vacuumlo(const char *database, const struct _param *param)
243243
PQfinish(conn);
244244
if (schema != NULL)
245245
PQfreemem(schema);
246-
if (schema != NULL)
246+
if (table != NULL)
247247
PQfreemem(table);
248-
if (schema != NULL)
248+
if (field != NULL)
249249
PQfreemem(field);
250250
return -1;
251251
}

0 commit comments

Comments
 (0)