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

Commit138184a

Browse files
committed
Plug memory leak when reloading config file.
The absolute path to config file was not pfreed. There are probably moresmall 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 tobe a problem, but this one is trivial enough that might as well fix it.Backpatch to 9.3 where the leak was introduced.
1 parentbb59845 commit138184a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
409409
ConfigVariable **head_p,
410410
ConfigVariable **tail_p)
411411
{
412+
char *abs_path;
412413
boolOK =true;
413414
FILE *fp;
414415

@@ -426,28 +427,29 @@ ParseConfigFile(const char *config_file, const char *calling_file, bool strict,
426427
returnfalse;
427428
}
428429

429-
config_file =AbsoluteConfigLocation(config_file,calling_file);
430-
fp =AllocateFile(config_file,"r");
430+
abs_path =AbsoluteConfigLocation(config_file,calling_file);
431+
fp =AllocateFile(abs_path,"r");
431432
if (!fp)
432433
{
433434
if (strict)
434435
{
435436
ereport(elevel,
436437
(errcode_for_file_access(),
437438
errmsg("could not open configuration file\"%s\": %m",
438-
config_file)));
439+
abs_path)));
439440
returnfalse;
440441
}
441442

442443
ereport(LOG,
443444
(errmsg("skipping missing configuration file\"%s\"",
444-
config_file)));
445+
abs_path)));
445446
return OK;
446447
}
447448

448-
OK =ParseConfigFp(fp,config_file, depth, elevel, head_p, tail_p);
449+
OK =ParseConfigFp(fp,abs_path, depth, elevel, head_p, tail_p);
449450

450451
FreeFile(fp);
452+
pfree(abs_path);
451453

452454
return OK;
453455
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp