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

Commit16c80e7

Browse files
committed
Ensure ParseTzFile() closes the input file after failing.
We hadn't noticed this because (a) few people feed invalidtimezone abbreviation files to the server, and (b) in typicalscenarios guc.c would throw ereport(ERROR) and then transactionabort handling would silently clean up the leaked file reference.However, it was possible to observe file leakage warnings if onebreaks an already-active abbreviation file, because guc.c doesnot throw ERROR when loading supposedly-validated settings duringsession start or SIGHUP processing.Report and fix by Kyotaro Horiguchi (cosmetic adjustments by me)Discussion:https://postgr.es/m/20220530.173740.748502979257582392.horikyota.ntt@gmail.com
1 parentc03b7f5 commit16c80e7

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

‎src/backend/utils/misc/tzparser.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ ParseTzFile(const char *filename, int depth,
364364
{
365365
GUC_check_errmsg("could not read time zone file \"%s\": %m",
366366
filename);
367-
return-1;
367+
n=-1;
368+
break;
368369
}
369370
/* else we're at EOF after all */
370371
break;
@@ -374,7 +375,8 @@ ParseTzFile(const char *filename, int depth,
374375
/* the line is too long for tzbuf */
375376
GUC_check_errmsg("line is too long in time zone file \"%s\", line %d",
376377
filename,lineno);
377-
return-1;
378+
n=-1;
379+
break;
378380
}
379381

380382
/* skip over whitespace */
@@ -397,12 +399,13 @@ ParseTzFile(const char *filename, int depth,
397399
{
398400
GUC_check_errmsg("@INCLUDE without file name in time zone file \"%s\", line %d",
399401
filename,lineno);
400-
return-1;
402+
n=-1;
403+
break;
401404
}
402405
n=ParseTzFile(includeFile,depth+1,
403406
base,arraysize,n);
404407
if (n<0)
405-
return-1;
408+
break;
406409
continue;
407410
}
408411

@@ -413,12 +416,18 @@ ParseTzFile(const char *filename, int depth,
413416
}
414417

415418
if (!splitTzLine(filename,lineno,line,&tzentry))
416-
return-1;
419+
{
420+
n=-1;
421+
break;
422+
}
417423
if (!validateTzEntry(&tzentry))
418-
return-1;
424+
{
425+
n=-1;
426+
break;
427+
}
419428
n=addToArray(base,arraysize,n,&tzentry,override);
420429
if (n<0)
421-
return-1;
430+
break;
422431
}
423432

424433
FreeFile(tzFile);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp