mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Plug more memory leaks when reloading config file.
Commit138184adc5
plugged 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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user