pg_amcheck: Fix inconsistency in memory freeing
authorMichael Paquier <[email protected]>
Thu, 27 Feb 2025 05:05:51 +0000 (14:05 +0900)
committerMichael Paquier <[email protected]>
Thu, 27 Feb 2025 05:05:51 +0000 (14:05 +0900)
The function in charge of freeing the memory from a result created by
PQescapeIdentifier() has to be PQfreemem(), to ensure that both
allocation and free come from libpq, but one spot in pg_amcheck was
missing that.

Oversight in b859d94c6389.

Author: Ranier Vilela <[email protected]>
Reviewed-by: vignesh C <[email protected]>
Discussion: https://postgr.es/m/CAEudQArD_nKSnYCNUZiPPsJ2tNXgRmLbXGSOrH1vpOF_XtP0Vg@mail.gmail.com
Discussion: https://postgr.es/m/CAEudQArbTWVSbxq608GRmXJjnNSQ0B6R7CSffNnj2hPWMUsRNg@mail.gmail.com
Backpatch-through: 14

src/bin/pg_amcheck/pg_amcheck.c

index 996833ed400c38bf445f043ebad26554dd744a10..2b1fd566c353fc3b38897608c0a9e8587250ed23 100644 (file)
@@ -560,7 +560,7 @@ main(int argc, char *argv[])
 
            executeCommand(conn, install_sql, opts.echo);
            pfree(install_sql);
-           pfree(schema);
+           PQfreemem(schema);
        }
 
        /*