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

Commitefcdb62

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 parent86e58ae commitefcdb62

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
@@ -437,18 +437,22 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
437437
(errcode_for_file_access(),
438438
errmsg("could not open configuration file\"%s\": %m",
439439
abs_path)));
440-
returnfalse;
440+
OK =false;
441+
goto cleanup;
441442
}
442443

443444
ereport(LOG,
444445
(errmsg("skipping missing configuration file\"%s\"",
445446
abs_path)));
446-
return OK;
447+
OK =true;
448+
goto cleanup;
447449
}
448450

449451
OK =ParseConfigFp(fp, abs_path, depth, elevel, head_p, tail_p);
450452

451-
FreeFile(fp);
453+
cleanup:
454+
if (fp)
455+
FreeFile(fp);
452456
pfree(abs_path);
453457

454458
return OK;
@@ -716,7 +720,8 @@ ParseConfigDirectory(const char *includedir,
716720
(errcode_for_file_access(),
717721
errmsg("could not open configuration directory\"%s\": %m",
718722
directory)));
719-
returnfalse;
723+
status =false;
724+
goto cleanup;
720725
}
721726

722727
/*
@@ -771,7 +776,8 @@ ParseConfigDirectory(const char *includedir,
771776
(errcode_for_file_access(),
772777
errmsg("could not stat file\"%s\": %m",
773778
filename)));
774-
returnfalse;
779+
status =false;
780+
goto cleanup;
775781
}
776782
}
777783

@@ -792,7 +798,9 @@ ParseConfigDirectory(const char *includedir,
792798
status =true;
793799

794800
cleanup:
795-
FreeDir(d);
801+
if (d)
802+
FreeDir(d);
803+
pfree(directory);
796804
return status;
797805
}
798806

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp