| From: | Jeff Davis <pgsql(at)j-davis(dot)com> | 
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Fix minor memory leak in connection string validation | 
| Date: | 2024-01-12 23:06:26 | 
| Message-ID: | 066a65233d3cb4ea27a9e0778d2f1d0dc764b222.camel@j-davis.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Introduced in commit c3afe8cf5a.
Someone issuing repeated "CREATE SUBSCRIPTION" commands where the
connection has no password and must_have_password is true will leak
malloc'd memory in the error path. Minor issue in practice, because I
suspect that a user privileged enough to create a subscription could
cause bigger problems.
It makes me wonder if we should use the resowner mechanism to track
pointers to malloc'd memory. Then we could use a standard pattern for
these kinds of cases, and it would also catch more remote issues, like
if a pstrdup() fails in an error path (which can happen a few lines up
if the parse fails).
Patch attached; intended for 16 and 17.
Regards,
	Jeff Davis
| Attachment | Content-Type | Size | 
|---|---|---|
| 0001-Fix-memory-leak-in-connection-string-validation.patch | text/x-patch | 1.1 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2024-01-13 00:39:28 | Re: cfbot is failing all tests on FreeBSD/Meson builds | 
| Previous Message | Tom Lane | 2024-01-12 22:57:24 | Re: pg_upgrade failing for 200+ million Large Objects |