Message ID | patch-v5-14.19-15e4b8db805-20230118T120334Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | leak fixes: various simple leak fixes | expand |
On Wed, Jan 18, 2023 at 5:14 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > > Plug a memory leak introduced in [1], since that change didn't follow > the "goto done" pattern introduced in [2] we'd leak the "&buf" memory. > > 1. e4cdfe84a0d (merge: abort if index does not match HEAD for trivial > merges, 2022-07-23) > 2. d5a35c114ab (Copy resolve_ref() return value for longer use, > 2011-11-13) > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > builtin/merge.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/builtin/merge.c b/builtin/merge.c > index 91dd5435c59..2b13124c497 100644 > --- a/builtin/merge.c > +++ b/builtin/merge.c > @@ -1618,7 +1618,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix) > error(_("Your local changes to the following files would be overwritten by merge:\n %s"), > sb.buf); > strbuf_release(&sb); > - return 2; > + ret = 2; > + goto done; > } > > /* See if it is really trivial. */ > -- > 2.39.0.1225.g30a3d88132d Thanks for fixing my bug!
diff --git a/builtin/merge.c b/builtin/merge.c index 91dd5435c59..2b13124c497 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1618,7 +1618,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix) error(_("Your local changes to the following files would be overwritten by merge:\n %s"), sb.buf); strbuf_release(&sb); - return 2; + ret = 2; + goto done; } /* See if it is really trivial. */
Plug a memory leak introduced in [1], since that change didn't follow the "goto done" pattern introduced in [2] we'd leak the "&buf" memory. 1. e4cdfe84a0d (merge: abort if index does not match HEAD for trivial merges, 2022-07-23) 2. d5a35c114ab (Copy resolve_ref() return value for longer use, 2011-11-13) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/merge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)