Skip to content

Commit 12a45a2

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/15838-3221652c72c5e69d@postgresql.org
1 parent 17aa054 commit 12a45a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/vacuumlo/vacuumlo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ vacuumlo(const char *database, const struct _param *param)
245245
PQfinish(conn);
246246
if (schema != NULL)
247247
PQfreemem(schema);
248-
if (schema != NULL)
248+
if (table != NULL)
249249
PQfreemem(table);
250-
if (schema != NULL)
250+
if (field != NULL)
251251
PQfreemem(field);
252252
return -1;
253253
}

0 commit comments

Comments
 (0)