1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Fix memory leaks in error reporting with LOG level

When loglevel is set to LOG, allocated strings used in the error
message would leak. Fix by explicitly pfreeing them.

Author: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAEudQAqMeE0AHcOsOzZx51Z0eiFJAjhBPRFt+Bxi3ETXWen7ig@mail.gmail.com
This commit is contained in:
Daniel Gustafsson
2024-05-14 10:41:32 +02:00
parent ab4d7a38c3
commit b362d14816
2 changed files with 7 additions and 1 deletions

View File

@@ -125,9 +125,11 @@ shell_archive_file(ArchiveModuleState *state, const char *file,
errdetail("The failed archive command was: %s",
xlogarchcmd)));
}
pfree(xlogarchcmd);
return false;
}
pfree(xlogarchcmd);
elog(DEBUG1, "archived write-ahead log file \"%s\"", file);
return true;