]> git.proxmox.com Git - libgit2.git/commitdiff
xmerge: fix memory leak on error path
authorPatrick Steinhardt <ps@pks.im>
Mon, 22 Feb 2016 16:13:23 +0000 (17:13 +0100)
committerPatrick Steinhardt <ps@pks.im>
Tue, 23 Feb 2016 11:07:37 +0000 (12:07 +0100)
src/xdiff/xmerge.c

index 7b7e0e2d36e0990525093cefe26ded52f99861d9..7928d14189b4bbace2ce48552e6c7186c6b124be 100644 (file)
@@ -646,6 +646,8 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
        if (xdl_change_compact(&xe2.xdf1, &xe2.xdf2, xpp->flags) < 0 ||
            xdl_change_compact(&xe2.xdf2, &xe2.xdf1, xpp->flags) < 0 ||
            xdl_build_script(&xe2, &xscr2) < 0) {
+               xdl_free_script(xscr1);
+               xdl_free_env(&xe1);
                xdl_free_env(&xe2);
                return -1;
        }