[Reproducible-commits] [dpkg] 09/25: u-a: Fix memory leaks in alternative_parse_fileset()

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.16.16
in repository dpkg.

commit 52b018e762f35bc8fb6fd3628a490c8f487011e0
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Apr 28 22:07:29 2014 +0200

    u-a: Fix memory leaks in alternative_parse_fileset()
    
    Cherry picked from commit 2579acce1f6add74150790e806d859c3f3f8d362.
    
    Free prio_str and master_file.
    
    Warned-by: coverity
---
 debian/changelog            | 1 +
 utils/update-alternatives.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9152e1f..265d7c9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ dpkg (1.16.15+nmu1) UNRELEASED; urgency=low
   * Do not leak the filepackages iterator when a directory is used by other
     packages.
   * Do not leak color string on «dselect --color».
+  * Fix memory leaks when parsing alternatives.
 
   [ Updated scripts translations ]
   * Fix typos in German (Helge Kreutzmann)
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 5f4364b..0c2b852 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1238,6 +1238,8 @@ alternative_parse_fileset(struct alternative *a, struct altdb_context *ctx)
 			ctx->bad_format(ctx,
 			                _("priority of %s is out of range: %s"),
 			                master_file, prio_str);
+		free(prio_str);
+
 		fs = fileset_new(master_file, prio);
 		for (sl = a->slaves; sl; sl = sl->next) {
 			fileset_add_slave(fs, xstrdup(sl->name),
@@ -1245,6 +1247,8 @@ alternative_parse_fileset(struct alternative *a, struct altdb_context *ctx)
 		}
 		alternative_add_choice(a, fs);
 	}
+	free(master_file);
+
 	return true;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list