From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix memory leaks from incorrect strsep() uses
Date: Fri, 18 Oct 2024 09:34:14 +0000
Message-ID: <E1t1jN9-001MHF-Bw@gemulon.postgresql.org> (raw)
Fix memory leaks from incorrect strsep() uses
Commit 5d2e1cc117b introduced some strsep() uses, but it did the
memory management wrong in some cases. We need to keep a separate
pointer to the allocate memory so that we can free it later, because
strsep() advances the pointer we pass to it, and it at the end it
will be NULL, so any free() calls won't do anything.
(This fixes two of the four places changed in commit 5d2e1cc117b. The
other two don't have this problem.)
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/79692bf9-17d3-41e6-b9c9-fc8c3944222a@eisentraut.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4b652692e97923298d0c7b9c1c303fc648984d92
Modified Files
--------------
src/common/logging.c | 3 ++-
src/test/regress/pg_regress.c | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix memory leaks from incorrect strsep() uses
In-Reply-To: <E1t1jN9-001MHF-Bw@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox