Просмотр исходного кода

libcompat: On successful realloc assign the newlist to list

Guillem Jover лет назад: 16
Родитель
Сommit
5a580e28ba
2 измененных файлов с 4 добавлено и 0 удалено
  1. 3 0
      debian/changelog
  2. 1 0
      lib/compat/scandir.c

+ 3 - 0
debian/changelog

@@ -1,5 +1,8 @@
 dpkg (1.15.9) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Fix realloc usage on compat scandir() implementation.
+
   [ Updated man page translations ]
   * German (Helge Kreutzmann).
 

+ 1 - 0
lib/compat/scandir.c

@@ -74,6 +74,7 @@ scandir(const char *dir, struct dirent ***namelist,
 			newlist = realloc(list, avail * sizeof(struct dirent *));
 			if (!newlist)
 				return cleanup(d, list, used);
+			list = newlist;
 		}
 
 		m = malloc(sizeof(struct dirent) + strlen(e->d_name));