aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-10-24 15:21:50 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-10-24 15:28:15 +0300
commitbb604d03abf1402764d384acb1ae36d379965126 (patch)
treedb66c6478c664362d0cb5e1599d2300a7b336668 /src
parentb0aa17706e210dec4e8d744eac1682e0c6a0a3b0 (diff)
downloadpostgresql-bb604d03abf1402764d384acb1ae36d379965126.tar.gz
postgresql-bb604d03abf1402764d384acb1ae36d379965126.zip
Plug memory leak when reloading config file.
The absolute path to config file was not pfreed. There are probably more small leaks here and there in the config file reload code and assign hooks, and in practice no-one reloads the config files frequently enough for it to be a problem, but this one is trivial enough that might as well fix it. Backpatch to 9.3 where the leak was introduced.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/misc/guc-file.l12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index b730a120d8e..c5ca4a40742 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -409,6 +409,7 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
ConfigVariable **head_p,
ConfigVariable **tail_p)
{
+ char *abs_path;
bool OK = true;
FILE *fp;
@@ -426,8 +427,8 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
return false;
}
- config_file = AbsoluteConfigLocation(config_file,calling_file);
- fp = AllocateFile(config_file, "r");
+ abs_path = AbsoluteConfigLocation(config_file, calling_file);
+ fp = AllocateFile(abs_path, "r");
if (!fp)
{
if (strict)
@@ -435,19 +436,20 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
ereport(elevel,
(errcode_for_file_access(),
errmsg("could not open configuration file \"%s\": %m",
- config_file)));
+ abs_path)));
return false;
}
ereport(LOG,
(errmsg("skipping missing configuration file \"%s\"",
- config_file)));
+ abs_path)));
return OK;
}
- OK = ParseConfigFp(fp, config_file, depth, elevel, head_p, tail_p);
+ OK = ParseConfigFp(fp, abs_path, depth, elevel, head_p, tail_p);
FreeFile(fp);
+ pfree(abs_path);
return OK;
}