[Patch] timezone/zic.c: Fix file handle leak in dolink()

Поиск
Список
Период
Сортировка
Искать

[Patch] timezone/zic.c: Fix file handle leak in dolink()

От:
"zengman" <zengman@halodbtech.com>
Дата:
Вложения:
Hi all,

I noticed a small issue and made a tiny patch to fix it — it addresses a file handle leak in the dolink() function of src/timezone/zic.c. 

--
Regards,
Man Zeng
www.openhalo.org

Re: [Patch] timezone/zic.c: Fix file handle leak in dolink()

От:
"zengman" <zengman@halodbtech.com>
Дата:
Вложения:
Furthermore, I noticed that some of the test code in `contrib/pg_trgm/trgm_regexp.c` does not check the return value of the `fopen()` call. 
I'm not sure if it's necessary to make the modification.

--
Regards,
Man Zeng
www.openhalo.org

Re: [Patch] timezone/zic.c: Fix file handle leak in dolink()

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"=?gb18030?B?emVuZ21hbg==?="  writes:
> I noticed a small issue and made a tiny patch to fix it ¡ª it addresses a file handle leak in the dolink() function of src/timezone/zic.c. 

Huh?  The program is going to exit() two lines further down.
What's the point of closing here?

Even if there were a plausible argument for issuing close(),
I wouldn't care to diverge from upstream zic.  If you like
you can go try to persuade the tzdb crew that this is a
useful change.

			regards, tom lane


Re: [Patch] timezone/zic.c: Fix file handle leak in dolink()

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"=?ISO-8859-1?B?emVuZ21hbg==?="  writes:
> Furthermore, I noticed that some of the test code in `contrib/pg_trgm/trgm_regexp.c` does not check the return value of the `fopen()` call. 
> I'm not sure if it's necessary to make the modification.

Probably not worth the trouble.  This is barely even debug-grade
code, seeing that there's no provision to change the target file
name.  It's clearly not meant for use in unfriendly environments.

			regards, tom lane


Re: [Patch] timezone/zic.c: Fix file handle leak in dolink()

От:
"zengman" <zengman@halodbtech.com>
Дата:
Got it, thank you for your guidance.

--
Regards,
Man Zeng
www.openhalo.org
FAQ