Sfoglia il codice sorgente

Fix small memory leaks related to scandir()

The array of pointers returned by scandir and the pointers in it were
not being freed.
Guillem Jover 16 anni fa
parent
commit
c264dd83d3
3 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 1 0
      debian/changelog
  2. 3 0
      dpkg-deb/info.c
  3. 1 0
      lib/dpkg/myopt.c

+ 1 - 0
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

+ 3 - 0
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);

+ 1 - 0
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);
   }