On Mon, Apr 20, 2026 at 11:30 PM David G. Johnston <
[email protected]> wrote:

> On Monday, April 20, 2026, a.kozhemyakin <[email protected]>
> wrote:
>>
>> The following script, when built with addresssanitizer, fails with a
>> DoubleFree error. reproduce on master (d3bba0415435)
>>
>
> Thanks for the report.  To be honest, I’m not sure where to start
> debugging it - but I plan to give it a go.  I’m curious if it fails for
> “\pset null ‘N’” “\g (null=csv)” too and I just got bit by inheriting its
> layout.  Don’t see why these new ones would be different.
>
>
Had issues getting a server to run meson+asan but did get psql to do so and
confirmed.

I just didn't find all of the patterns.

savePsetInfo and restorePsetInfo need explicit knowledge of these options
as well to clean up the popt struct.

Attached.

David J.
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..01b8f11aadd 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -5680,6 +5680,10 @@ savePsetInfo(const printQueryOpt *popt)
 		save->topt.tableAttr = pg_strdup(popt->topt.tableAttr);
 	if (popt->nullPrint)
 		save->nullPrint = pg_strdup(popt->nullPrint);
+	if (popt->truePrint)
+		save->truePrint = pg_strdup(popt->truePrint);
+	if (popt->falsePrint)
+		save->falsePrint = pg_strdup(popt->falsePrint);
 	if (popt->title)
 		save->title = pg_strdup(popt->title);
 
@@ -5707,6 +5711,8 @@ restorePsetInfo(printQueryOpt *popt, printQueryOpt *save)
 	free(popt->topt.recordSep.separator);
 	free(popt->topt.tableAttr);
 	free(popt->nullPrint);
+	free(popt->truePrint);
+	free(popt->falsePrint);
 	free(popt->title);
 
 	/*

Reply via email to