From: Heikki Linnakangas Date: Fri, 7 Jun 2019 09:44:04 +0000 (+0300) Subject: Fix copy-pasto in freeing memory on error in vacuumlo. X-Git-Tag: REL9_6_14~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2558776b415097610ab69a03604e79d6958608bc;p=postgresql 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 --- diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index fd8dce5666..28f86175e9 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -240,9 +240,9 @@ vacuumlo(const char *database, const struct _param * param) PQfinish(conn); if (schema != NULL) PQfreemem(schema); - if (schema != NULL) + if (table != NULL) PQfreemem(table); - if (schema != NULL) + if (field != NULL) PQfreemem(field); return -1; }