Browse code

Fix file descriptor leak when PDF files fails to parse

git-svn: trunk@1629

Nigel Horne authored on 2005/06/23 05:52:51
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Jun 22 21:51:49 BST 2005 (njh)
2
+----------------------------------
3
+  * libclamav/pdf.c:	Remember to close a file that fails to parse. Fix by
4
+				John Callaghan <jpc at msu.edu>
5
+
1 6
 Wed Jun 22 20:12:54 CEST 2005 (tk)
2 7
 ----------------------------------
3 8
   * clamd/clamd.c, shared/output.c: improve output handling (Patch by Mark
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: pdf.c,v 1.25 2005/06/04 20:38:43 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: pdf.c,v 1.26 2005/06/22 20:50:09 nigelhorne Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -260,6 +260,7 @@ cli_pdf(const char *dir, int desc)
260 260
 
261 261
 			if(tmpbuf == NULL) {
262 262
 				rc = CL_EMEM;
263
+				close(fout);
263 264
 				continue;
264 265
 			}
265 266
 
... ...
@@ -268,6 +269,7 @@ cli_pdf(const char *dir, int desc)
268 268
 			if(ret == -1) {
269 269
 				free(tmpbuf);
270 270
 				rc = CL_EFORMAT;
271
+				close(fout);
271 272
 				continue;
272 273
 			}
273 274
 			streamlen = (size_t)ret;