1
0
mirror of https://github.com/git/git.git synced 2024-11-15 17:03:14 +01:00

Merge branch 'ps/plug-xdl-merge-leak' into maint

* ps/plug-xdl-merge-leak:
  xdiff/xmerge: fix memory leak in xdl_merge
This commit is contained in:
Junio C Hamano 2016-03-10 11:13:49 -08:00
commit 4da402695d

@ -641,8 +641,11 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
result->ptr = NULL;
result->size = 0;
if (xdl_do_diff(orig, mf1, xpp, &xe1) < 0 ||
xdl_do_diff(orig, mf2, xpp, &xe2) < 0) {
if (xdl_do_diff(orig, mf1, xpp, &xe1) < 0) {
return -1;
}
if (xdl_do_diff(orig, mf2, xpp, &xe2) < 0) {
xdl_free_env(&xe1);
return -1;
}
if (xdl_change_compact(&xe1.xdf1, &xe1.xdf2, xpp->flags) < 0 ||
@ -654,6 +657,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;
}