Explorar el Código

u-a: Fix memory leaks due to scandir() return value

Guillem Jover hace 15 años
padre
commit
7221d533e9
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      utils/update-alternatives.c

+ 3 - 0
utils/update-alternatives.c

@@ -471,7 +471,9 @@ config_all(void)
 	for (i = 0; i < count; i++) {
 		subcall(prog_path, "--config", table[i]->d_name, NULL);
 		printf("\n");
+		free(table[i]);
 	}
+	free(table);
 }
 
 static bool
@@ -2197,6 +2199,7 @@ main(int argc, char **argv)
 
 		free(table[i]);
 	}
+	free(table);
 
 	/* Check that caller don't mix links between alternatives and don't mix
 	 * alternatives between slave/master, and that the various parameters