Browse code

close zzip descriptor when tmpfile() fails

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1370 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2005/03/04 10:11:06
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Mar  4 02:08:45 CET 2005 (tk)
2
+---------------------------------
3
+  * libclamav/scanners.c: close zzip descriptor when tmpfile() fails
4
+			  (patch by <ocherechin*ukr.net>)
5
+
1 6
 Fri Mar  4 01:57:28 CET 2005 (tk)
2 7
 ---------------------------------
3 8
   * libclamav, freshclam: "DON'T PANIC!" warnings (idea by Luca Gibelli)
... ...
@@ -451,6 +451,7 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
451 451
 	/* generate temporary file and get its descriptor */
452 452
 	if((tmp = tmpfile()) == NULL) {
453 453
 	    cli_dbgmsg("Zip: Can't generate tmpfile().\n");
454
+	    zzip_file_close(zfp);
454 455
 	    ret = CL_ETMPFILE;
455 456
 	    break;
456 457
 	}
... ...
@@ -468,7 +469,6 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
468 468
 
469 469
 	zzip_file_close(zfp);
470 470
 
471
-
472 471
 	if(fflush(tmp) != 0) {
473 472
 	    cli_dbgmsg("Zip: fflush() failed: %s\n", strerror(errno));
474 473
 	    ret = CL_EFSYNC;