[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
javacomp: fix handle leak
From: |
Bruno Haible |
Subject: |
javacomp: fix handle leak |
Date: |
Tue, 16 May 2017 21:31:35 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; ) |
The first fallout of the recent Coverity scan:
2017-05-16 Bruno Haible <address@hidden>
javacomp: Fix handle leak.
Found by Coverity.
* lib/javacomp.c (get_classfile_version): Close fd before returning.
diff --git a/lib/javacomp.c b/lib/javacomp.c
index fe15b2c..3d7d457 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -525,7 +525,10 @@ get_classfile_version (const char *compiled_file_name)
/* Verify the class file signature. */
if (header[0] == 0xCA && header[1] == 0xFE
&& header[2] == 0xBA && header[3] == 0xBE)
- return header[7];
+ {
+ close (fd);
+ return header[7];
+ }
}
close (fd);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- javacomp: fix handle leak,
Bruno Haible <=