Fix minor memory leak in connection string validation
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-hackers@postgresql.org
Date: 2024-01-12T23:06:26Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-memory-leak-in-connection-string-validation.patch (text/x-patch) patch 0001
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
Commits
-
Fix memory leak in connection string validation.
- 45da69371ebf 17.0 landed
- 41820e640af1 16.2 landed
-
Add new predefined role pg_create_subscription.
- c3afe8cf5a1e 16.0 cited