1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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 9c08aea6a3, so there's no need to backpatch.

As pointed out by Coverity.
This commit is contained in:
Alvaro Herrera
2022-04-25 10:32:13 +02:00
parent f819020d40
commit 0bd56172b2
2 changed files with 14 additions and 0 deletions

View File

@ -1057,6 +1057,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
}
SetDatabasePath(fullpath);
pfree(fullpath);
/*
* It's now possible to do real access to the system catalogs.