mirror of
https://github.com/postgres/postgres.git
synced 2026-05-28 04:35:45 -04:00
Plug more memory leaks when reloading config file.
Commit138184adc5plugged some but not all of the leaks from commit2a0c81a12c. This tightens things up some more. Amit Kapila, per an observation by Tom Lane
This commit is contained in:
parent
86e58ae023
commit
efcdb625b3
1 changed files with 14 additions and 6 deletions
|
|
@ -437,18 +437,22 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
|
|||
(errcode_for_file_access(),
|
||||
errmsg("could not open configuration file \"%s\": %m",
|
||||
abs_path)));
|
||||
return false;
|
||||
OK = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ereport(LOG,
|
||||
(errmsg("skipping missing configuration file \"%s\"",
|
||||
abs_path)));
|
||||
return OK;
|
||||
OK = true;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
OK = ParseConfigFp(fp, abs_path, depth, elevel, head_p, tail_p);
|
||||
|
||||
FreeFile(fp);
|
||||
cleanup:
|
||||
if (fp)
|
||||
FreeFile(fp);
|
||||
pfree(abs_path);
|
||||
|
||||
return OK;
|
||||
|
|
@ -716,7 +720,8 @@ ParseConfigDirectory(const char *includedir,
|
|||
(errcode_for_file_access(),
|
||||
errmsg("could not open configuration directory \"%s\": %m",
|
||||
directory)));
|
||||
return false;
|
||||
status = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -771,7 +776,8 @@ ParseConfigDirectory(const char *includedir,
|
|||
(errcode_for_file_access(),
|
||||
errmsg("could not stat file \"%s\": %m",
|
||||
filename)));
|
||||
return false;
|
||||
status = false;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -792,7 +798,9 @@ ParseConfigDirectory(const char *includedir,
|
|||
status = true;
|
||||
|
||||
cleanup:
|
||||
FreeDir(d);
|
||||
if (d)
|
||||
FreeDir(d);
|
||||
pfree(directory);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue