[Reproducible-commits] [dpkg] 28/61: u-a: Fix memory leak in alternative_config_all()

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Sep 21 09:56:08 UTC 2015


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

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit de6b7323ff3929d70a849de28bb4606ab32360a5
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Sep 14 21:22:30 2015 +0200

    u-a: Fix memory leak in alternative_config_all()
    
    Warned-by: coverity
---
 utils/update-alternatives.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 842c3ad..916a191 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1583,7 +1583,7 @@ alternative_select_choice(struct alternative *a)
 		}
 		selection[strlen(selection) - 1] = '\0';
 		if (strlen(selection) == 0)
-			return current;
+			return xstrdup(current);
 		errno = 0;
 		idx = strtol(selection, &ret, 10);
 		if (idx < 0 || errno != 0)
@@ -2306,6 +2306,8 @@ alternative_config_all(void)
 		new_choice = alternative_config(am->item, current_choice);
 
 		alternative_update(am->item, current_choice, new_choice);
+
+		free(new_choice);
 	}
 
 	alternative_map_free(alt_map_obj);

-- 
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