[PATCH] fnt2bdf: fixed 2 resource leaks
Marcus Meissner
marcus at jet.franken.de
Sat Aug 8 03:44:09 CDT 2009
Hi,
Fixed:
[../wine-git/tools/fnt2bdf.c:219]: (error) Resource leak: fp
One fclose() missing in exit path. This could lead
to file corruption.
[../wine-git/tools/fnt2bdf.c:653]: (error) Resource leak: fd
The error check of open(2) was wrong (checking for 0
instead of -1).
Ciao, Marcus
---
tools/fnt2bdf.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c
index 277764b..f9f6647 100644
--- a/tools/fnt2bdf.c
+++ b/tools/fnt2bdf.c
@@ -216,7 +216,10 @@ static int dump_bdf( fnt_fontS* cpe_font_struct, unsigned char* file_buffer)
}
ic = dump_bdf_hdr(fp, cpe_font_struct, file_buffer);
- if (ic) return (ic);
+ if (ic) {
+ fclose(fp);
+ return (ic);
+ }
/* NOW, convert all chars to UNIX (lton) notation... */
@@ -544,7 +547,7 @@ int main(int argc, char **argv)
parse_options( argc, argv);
- if( (fd = open( g_lpstrInputFile, O_RDONLY | O_BINARY)) )
+ if( (fd = open( g_lpstrInputFile, O_RDONLY | O_BINARY)) != -1 )
{
int i;
struct stat file_stat;
--
1.5.6
More information about the wine-patches
mailing list