Browse Source

dpkg: Fix varbuf memory leaks

In «dpkg --verify» and the dpkg infodb format upgrade logic.

Both are not big leaks, the first is bound by the amount of packages,
as the varbuf is reused for each file on each package, and the second
is just one instance of a leaked varbuf.

Stable-Candidate: 1.16.x 1.17.x
Guillem Jover 8 years ago
parent
commit
af5a9c80d4
3 changed files with 4 additions and 0 deletions
  1. 1 0
      debian/changelog
  2. 1 0
      src/infodb-upgrade.c
  3. 2 0
      src/verify.c

+ 1 - 0
debian/changelog

@@ -8,6 +8,7 @@ dpkg (1.18.4) UNRELEASED; urgency=low
     state, otherwise we end up not passing the previously configured version
     to «postinst configure», which might consider this a first install instead
     of an upgrade. Closes: #801156
+  * Fix memory leaks in «dpkg --verify» and dpkg infodb format upgrade logic.
   * Build system:
     - Set PERL5LIB globally for the test suite to the local modules directory,
       to avoid using the system modules. Regression introduced in dpkg 1.17.8.

+ 1 - 0
src/infodb-upgrade.c

@@ -149,6 +149,7 @@ pkg_infodb_link_multiarch_files(void)
 	}
 	pop_cleanup(ehflag_normaltidy); /* closedir */
 
+	varbuf_destroy(&pkgname);
 	varbuf_destroy(&newname);
 	varbuf_destroy(&oldname);
 }

+ 2 - 0
src/verify.c

@@ -133,6 +133,8 @@ verify_package(struct pkginfo *pkg)
 		if (failures)
 			verify_output(fnn, &checks);
 	}
+
+	varbuf_destroy(&filename);
 }
 
 int