pgsql: Always pfree strings returned by GetDatabasePath

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Always pfree strings returned by GetDatabasePath
Date: 2022-04-25 08:39:12
Message-ID: E1niuFU-00127a-7o@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Always pfree strings returned by GetDatabasePath

Several places didn't do it, and in many cases it didn't matter because
it would be a small allocation in a short-lived context; but other
places may accumulate a few (for example, in CreateDatabaseUsingFileCopy,
one per tablespace). In most databases this is highly unlikely to be
very serious either, but it seems better to make the code consistent in
case there's future copy-and-paste.

The only case of actual concern seems to be the aforementioned routine,
which is new with commit 9c08aea6a309, so there's no need to backpatch.

As pointed out by Coverity.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0bd56172b2871e94c0d7115ffbf430308317ac49

Modified Files
--------------
src/backend/commands/dbcommands.c | 13 +++++++++++++
src/backend/utils/init/postinit.c | 1 +
2 files changed, 14 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2022-04-25 13:04:38 pgsql: Cover brin/gin/gist/spgist ambuildempty routines in regression t
Previous Message Andrew Dunstan 2022-04-24 19:37:06 Re: pgsql: Allow db.schema.table patterns, but complain about random garbag