Browse code

libclamav/others.c: fix fd feak on error path - bb#1141

git-svn: trunk@4124

Tomasz Kojm authored on 2008/08/21 20:27:48
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Aug 21 13:22:29 CEST 2008 (tk)
2
+----------------------------------
3
+  * libclamav/others.c: fix fd feak on error path - bb#1141
4
+
1 5
 Wed Aug 20 20:09:11 CEST 2008 (acab)
2 6
 ------------------------------------
3 7
   * libclamav/sis.c: fix fd feak on error path - bb#1141
... ...
@@ -800,8 +800,11 @@ int cli_filecopy(const char *src, const char *dest)
800 800
 	return -1;
801 801
     }
802 802
 
803
-    if(!(buffer = cli_malloc(FILEBUFF)))
803
+    if(!(buffer = cli_malloc(FILEBUFF))) {
804
+	close(s);
805
+	close(d);
804 806
 	return -1;
807
+    }
805 808
 
806 809
     while((bytes = cli_readn(s, buffer, FILEBUFF)) > 0)
807 810
 	cli_writen(d, buffer, bytes);