The following commit has been merged in the master branch:
commit 5a580e28ba68f1482291ad86d823b487f74bcd70
Author: Guillem Jover <[email protected]>
Date:   Thu Jul 29 20:26:53 2010 +0200

    libcompat: On successful realloc assign the newlist to list

diff --git a/debian/changelog b/debian/changelog
index 95e897c..876dea1 100644
--- a/debian/changelog
+++ b/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).
 
diff --git a/lib/compat/scandir.c b/lib/compat/scandir.c
index ea7c484..6eac251 100644
--- a/lib/compat/scandir.c
+++ b/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));

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to