Browse code

libclamav: tweak to cli_gentempfd()

David Raynor authored on 2014/01/17 02:20:08
Showing 1 changed files
... ...
@@ -903,7 +903,6 @@ char *cli_gentemp(const char *dir)
903 903
 
904 904
 int cli_gentempfd(const char *dir, char **name, int *fd)
905 905
 {
906
-
907 906
     *name = cli_gentemp(dir);
908 907
     if(!*name)
909 908
 	return CL_EMEM;
... ...
@@ -913,10 +912,11 @@ int cli_gentempfd(const char *dir, char **name, int *fd)
913 913
      * EEXIST is almost impossible to occur, so we just treat it as other
914 914
      * errors
915 915
      */
916
-   if(*fd == -1) {
917
-	cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, strerror(errno));
918
-	free(*name);
919
-	return CL_ECREAT;
916
+    if(*fd == -1) {
917
+        cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, strerror(errno));
918
+        free(*name);
919
+        *name = NULL;
920
+        return CL_ECREAT;
920 921
     }
921 922
 
922 923
     return CL_SUCCESS;