The following commit has been merged in the master branch:
commit c264dd83d33250927fe165de5336145afdf99610
Author: Guillem Jover <[email protected]>
Date:   Fri Feb 19 06:56:59 2010 +0100

    Fix small memory leaks related to scandir()
    
    The array of pointers returned by scandir and the pointers in it were
    not being freed.

diff --git a/debian/changelog b/debian/changelog
index 2089628..4709905 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,6 +65,7 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * Do not print unambiguous epoch on dpkg file overwrite error.
   * Rename Dpkg::IPC::fork_and_exec() to Dpkg::IPC::spawn().
   * Change dpkg-dev to Depend on perl instead of perl5 and perl-modules.
+  * Fix small memory leaks related to scandir() in dpkg-deb and libdpkg.
 
   [ Modestas Vainius ]
   * Implement symbol patterns (Closes: #563752). From now on, it is possible to
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index 9ce7e76..62ca9aa 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -169,7 +169,10 @@ static void info_list(const char *debar, const char 
*directory) {
     } else {
       printf(_("     not a plain file          %.255s\n"), cdep->d_name);
     }
+    free(cdep);
   }
+  free(cdlist);
+
   if (!(cc= fopen("control","r"))) {
     if (errno != ENOENT) ohshite(_("failed to read `control' (in 
`%.255s')"),directory);
     fputs(_("(no `control' file in control archive!)\n"), stdout);
diff --git a/lib/dpkg/myopt.c b/lib/dpkg/myopt.c
index 0b42dcf..ad35e68 100644
--- a/lib/dpkg/myopt.c
+++ b/lib/dpkg/myopt.c
@@ -176,6 +176,7 @@ load_config_dir(const char *prog, const struct cmdinfo* 
cmdinfos)
 
     myfileopt(filename, cmdinfos);
 
+    free(dlist[i]);
     free(filename);
   }
 

-- 
dpkg's main repository


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

Reply via email to