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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=01f23f01bba8182017d0b8ca0d8409469677b6a1

commit 01f23f01bba8182017d0b8ca0d8409469677b6a1
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Jul 25 03:23:02 2025 +0200

    dpkg: Fix memory leak in maintscript_fallback()
    
    Release the memory for the maintainer script description, just after
    we no longer need it, and before we overwrite the point with the next
    assignment. Move the command_destroy() call before the free() to match
    the other branches, so that it makes it obvious is the same pattern.
    
    Changelog: internal
---
 src/main/script.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/script.c b/src/main/script.c
index 0c6f3f2d2..ac4e01347 100644
--- a/src/main/script.c
+++ b/src/main/script.c
@@ -364,13 +364,15 @@ maintscript_fallback(struct pkginfo *pkg,
                post_script_tasks();
                return 1;
        }
+       command_destroy(&cmd);
+       free(buf);
+
        notice(_("trying script from the new package instead ..."));
 
        strcpy(cidirrest, scriptname);
        buf = str_fmt(_("new %s package %s script"),
                      pkg_name(pkg, pnaw_nonambig), desc);
 
-       command_destroy(&cmd);
        command_init(&cmd, cidir, buf);
        command_add_args(&cmd, scriptname, iffallback,
                         versiondescribe(&pkg->installed.version, 
vdew_nonambig),

-- 
Dpkg.Org's dpkg

Reply via email to