Переглянути джерело

dpkg: Fix a short-lived memory leak in archive argument parsing

Warned-by: coverity
Guillem Jover 10 роки тому
батько
коміт
8d6ada9596
2 змінених файлів з 4 додано та 1 видалено
  1. 1 0
      debian/changelog
  2. 3 1
      src/archives.c

+ 1 - 0
debian/changelog

@@ -1,6 +1,7 @@
 dpkg (1.18.10) UNRELEASED; urgency=medium
 
   [ Guillem Jover ]
+  * Fix a short-lived memory leak in dpkg archive argument parsing.
   * Documentation:
     - Document Testsuite-Triggers in dsc(5).
     - Fix deb-changes(5) description to talk about .changes instead of .dsc.

+ 3 - 1
src/archives.c

@@ -1435,6 +1435,7 @@ int
 archivefiles(const char *const *argv)
 {
   const char *const *volatile argp;
+  const char **volatile arglist = NULL;
   int i;
   jmp_buf ejbuf;
   enum modstatdb_rw msdbflags;
@@ -1458,7 +1459,6 @@ archivefiles(const char *const *argv)
   log_message("startup archives %s", cipaction->olong);
 
   if (f_recursive) {
-    const char **arglist = NULL;
     const char *const *ap;
     int nfiles = 0;
 
@@ -1552,6 +1552,8 @@ archivefiles(const char *const *argv)
 
   dpkg_selabel_close();
 
+  free(arglist);
+
   switch (cipaction->arg_int) {
   case act_install:
   case act_configure: