Skip to contentSkip to conversation

Fix memory leak

SETSEBOOL Ivan Gyurdiev 1 participant 1 message Nov 5, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

Fix memory leak which I introduced... I don't like introducing bugs of any sort..

policycoreutils/setsebool/setsebool.c +4 -2
diff -Naurp --exclude CVS --exclude ChangeLog --exclude VERSION --exclude Makefile old/policycoreutils/setsebool/setsebool.c new/policycoreutils/setsebool/setsebool.c
@@ -220,13 +220,15 @@ int setbool(char **list, size_t start, s
 		i++;
 	}
 
+	for (i=0; i < boolcnt; i++)
+		free(vallist[i].name);
+	free(vallist);
 	return 0;
 				
 	err:
 	for (i=0; i < boolcnt; i++) 
-		if (vallist[i].name) free(vallist[i].name);
+		free(vallist[i].name);
 	free(vallist);
-
 	return -1;
 }