Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

Started by Ranier Vilela11 months ago4 messages
#1Ranier Vilela
ranier.vf@gmail.com
1 attachment(s)

Hi.

Similar to commit 5b94e27 <http://5b94e2753439b699b78aacbb53e89bf0e814becc&gt;
[1]: /messages/by-id/CAEudQAp=AW5dJXrGLbC_aZg_9nOo=42W7uLDRONFQE-gcgnkgQ@mail.gmail.com
The correct function when freeing memory in the frontend,
using the function PQescapeIdentifier, must be
PQfreemem.

Trivial patch attached.

best regards,
Ranier Vilela

[1]: /messages/by-id/CAEudQAp=AW5dJXrGLbC_aZg_9nOo=42W7uLDRONFQE-gcgnkgQ@mail.gmail.com
/messages/by-id/CAEudQAp=AW5dJXrGLbC_aZg_9nOo=42W7uLDRONFQE-gcgnkgQ@mail.gmail.com

Attachments:

fix-api-misuse-pg_amcheck.patchapplication/octet-stream; name=fix-api-misuse-pg_amcheck.patchDownload
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index c5ec25be22..dda8b1b8ad 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -560,7 +560,7 @@ main(int argc, char *argv[])
 
 			executeCommand(conn, install_sql, opts.echo);
 			pfree(install_sql);
-			pfree(schema);
+			PQfreemem(schema);
 		}
 
 		/*
#2vignesh C
vignesh21@gmail.com
In reply to: Ranier Vilela (#1)
Re: Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

On Tue, 18 Feb 2025 at 18:18, Ranier Vilela <ranier.vf@gmail.com> wrote:

Hi.

Similar to commit 5b94e27 [1]
The correct function when freeing memory in the frontend,
using the function PQescapeIdentifier, must be
PQfreemem.

Trivial patch attached.

Thanks, this change looks good to me.

Regards,
Vignesh

#3Michael Paquier
michael@paquier.xyz
In reply to: vignesh C (#2)
Re: Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

On Wed, Feb 26, 2025 at 07:04:25PM +0530, vignesh C wrote:

On Tue, 18 Feb 2025 at 18:18, Ranier Vilela <ranier.vf@gmail.com> wrote:

Similar to commit 5b94e27 [1]
The correct function when freeing memory in the frontend,
using the function PQescapeIdentifier, must be
PQfreemem.

Trivial patch attached.

Thanks, this change looks good to me.

There's no point in leaving that unfixed in pg_amcheck, so done down
to 14 with 48e4ae9a0707.
--
Michael

#4Ranier Vilela
ranier.vf@gmail.com
In reply to: Michael Paquier (#3)
Re: Fix api misuse (src/bin/pg_amcheck/pg_amcheck.c)

Em qui., 27 de fev. de 2025 às 02:08, Michael Paquier <michael@paquier.xyz>
escreveu:

On Wed, Feb 26, 2025 at 07:04:25PM +0530, vignesh C wrote:

On Tue, 18 Feb 2025 at 18:18, Ranier Vilela <ranier.vf@gmail.com> wrote:

Similar to commit 5b94e27 [1]
The correct function when freeing memory in the frontend,
using the function PQescapeIdentifier, must be
PQfreemem.

Trivial patch attached.

Thanks, this change looks good to me.

There's no point in leaving that unfixed in pg_amcheck, so done down
to 14 with 48e4ae9a0707.

Thank you Michael.

best regards,
Ranier Vilela