This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=55700d23274a6487f5f91b43074b9027be1371d4 commit 55700d23274a6487f5f91b43074b9027be1371d4 Author: Guillem Jover <[email protected]> AuthorDate: Tue Aug 25 01:13:12 2020 +0200 u-a: Fix short-lived memory leaks for alternative structs Warned-by: gcc ASAN --- utils/update-alternatives.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index fd4146d11..569aca4ab 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -1484,6 +1484,7 @@ alternative_load(struct alternative *a, enum altdb_flags flags) syserr(_("cannot stat file '%s'"), ctx.filename); if (st.st_size == 0) { altdb_context_free(&ctx); + alternative_reset(a); return false; } @@ -3061,6 +3062,7 @@ main(int argc, char **argv) * link group file. */ if (!alternative_load(a, ALTDB_WARN_PARSER)) { verbose(_("no alternatives for %s"), a->master_name); + alternative_free(a); exit(0); } } else if (action == ACTION_INSTALL) { @@ -3104,6 +3106,7 @@ main(int argc, char **argv) /* Alternative already exists, check if anything got * updated. */ alternative_evolve(a, inst_alt, current_choice, fileset); + alternative_free(inst_alt); } else { /* Alternative doesn't exist, create from parameters. */ alternative_free(a); @@ -3123,5 +3126,8 @@ main(int argc, char **argv) if (modifies_alt) alternative_update(a, current_choice, new_choice); + if (a) + alternative_free(a); + return 0; } -- Dpkg.Org's dpkg

