Преглед изворни кода

lcr: Fix memleak in interface_find_and_load

Scandir result was not freed when no results were returned.

Patch is slight modification of patch sent by
Masse Nicolas <nicolas.masse@stormshield.eu>.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse пре 7 година
родитељ
комит
d17edf2ae3
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      lcr/lcr_ifact.c

+ 2 - 2
lcr/lcr_ifact.c

@@ -432,7 +432,7 @@ static int interface_find_and_load (
 	} /* scanning for lcrso loop */
 	} /* scanning for lcrso loop */
 
 
 
 
-	if (scandir_entries > 0) {
+	if (scandir_entries >= 0) {
 		int i;
 		int i;
 		for (i = 0; i < scandir_entries; i++) {
 		for (i = 0; i < scandir_entries; i++) {
 			free (scandir_list[i]);
 			free (scandir_list[i]);
@@ -444,7 +444,7 @@ static int interface_find_and_load (
 
 
 found:
 found:
 	*instance_ret = instance;
 	*instance_ret = instance;
-	if (scandir_entries > 0) {
+	if (scandir_entries >= 0) {
 		int i;
 		int i;
 		for (i = 0; i < scandir_entries; i++) {
 		for (i = 0; i < scandir_entries; i++) {
 			free (scandir_list[i]);
 			free (scandir_list[i]);