Re: Small memory fixes for pg_createsubcriber
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Euler Taveira <euler@eulerto.com>, "ranier.vf@gmail.com" <ranier.vf@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-02-12T23:56:53Z
Lists: pgsql-hackers
Attachments
- libpq-escape-fixes.patch (text/x-diff) patch
On Wed, Feb 12, 2025 at 12:00:03PM -0500, Andres Freund wrote: > Particularly for something like libpq it's not quitetrivial to add > attributes like this, of course. We can't even depend on pg_config.h. > > One way would be to define them in libpq-fe.h, guarded by an #ifdef, that's > "armed" by a commandline -D flag, if the compiler is supported? Interesting set of tricks. I have looked at bit at the uses of PQescapeLiteral() and PQescapeIdentifier() in the tree. On top of the one in pg_amcheck you are just pointing to, there is an inconsistency in pg_upgrade.c for set_locale_and_encoding() where datlocale_literal may be allocated with a pg_strdup() or a PQescapeLiteral() depending on the path. The code has been using PQfreemem() for the pg_strdup() allocation, which is logically incorrect. The pg_upgrade path is fancy as designed this way, for sure, but that's less invasive than hardcoding three times "NULL". Any thoughts about backpatching something like that for both of them? -- Michael
Commits
-
pg_upgrade: Fix inconsistency in memory freeing
- 9ca2145b00fb 16.9 landed
- ee78823ff5f6 17.5 landed
- 2a083ab807db 18.0 landed
-
pg_amcheck: Fix inconsistency in memory freeing
- 35a591a0486f 14.18 landed
- ec741d48036a 15.13 landed
- 816149dc6bf9 16.9 landed
- f903d4da9276 17.5 landed
- 48e4ae9a0707 18.0 landed
-
Fix some inconsistencies with memory freeing in pg_createsubscriber
- ff6d9cfcb17e 17.4 landed
- 5b94e2753439 18.0 landed
-
Drop pre-existing subscriptions from the converted subscriber.
- 4867f8a555ce 18.0 cited