Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5bca4e

Browse files
committed
Plug more memory leaks when reloading config file.
Commit138184a plugged some but notall of the leaks from commit2a0c81a.This tightens things up some more.Amit Kapila, per an observation by Tom Lane
1 parentd2458e3 commita5bca4e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎src/backend/utils/misc/guc-file.l

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,22 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
469469
(errcode_for_file_access(),
470470
errmsg("could not open configuration file\"%s\": %m",
471471
abs_path)));
472-
returnfalse;
472+
OK =false;
473+
goto cleanup;
473474
}
474475

475476
ereport(LOG,
476477
(errmsg("skipping missing configuration file\"%s\"",
477478
abs_path)));
478-
return OK;
479+
OK =true;
480+
goto cleanup;
479481
}
480482

481483
OK =ParseConfigFp(fp, abs_path, depth, elevel, head_p, tail_p);
482484

483-
FreeFile(fp);
485+
cleanup:
486+
if (fp)
487+
FreeFile(fp);
484488
pfree(abs_path);
485489

486490
return OK;
@@ -748,7 +752,8 @@ ParseConfigDirectory(const char *includedir,
748752
(errcode_for_file_access(),
749753
errmsg("could not open configuration directory\"%s\": %m",
750754
directory)));
751-
returnfalse;
755+
status =false;
756+
goto cleanup;
752757
}
753758

754759
/*
@@ -803,7 +808,8 @@ ParseConfigDirectory(const char *includedir,
803808
(errcode_for_file_access(),
804809
errmsg("could not stat file\"%s\": %m",
805810
filename)));
806-
returnfalse;
811+
status =false;
812+
goto cleanup;
807813
}
808814
}
809815

@@ -824,7 +830,9 @@ ParseConfigDirectory(const char *includedir,
824830
status =true;
825831

826832
cleanup:
827-
FreeDir(d);
833+
if (d)
834+
FreeDir(d);
835+
pfree(directory);
828836
return status;
829837
}
830838

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp