Browse code

fix CID# 11393

cwu authored on 2013/02/15 00:11:26
Showing 1 changed files
... ...
@@ -1019,8 +1019,10 @@ static int sigtool_scandir (const char *dirname, int hex_output)
1019 1019
 		if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) {
1020 1020
 		    /* build the full name */
1021 1021
 		    fname = (char *) cli_calloc (strlen (dirname) + strlen (dent->d_name) + 2, sizeof (char));
1022
-		    if(!fname)
1022
+		    if(!fname){
1023
+		        close(dd);
1023 1024
 		        return -1;	    
1025
+		    }	
1024 1026
 		    sprintf (fname, "%s"PATHSEP"%s", dirname, dent->d_name);
1025 1027
 
1026 1028
 		    /* stat the file */