Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
merge: small leakfix and code simplification
author
Junio C Hamano
<gitster@pobox.com>
Thu, 23 Apr 2015 21:37:13 +0000
(14:37 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 29 Apr 2015 20:17:52 +0000
(13:17 -0700)
When parsing a merged object name like "foo~20" to formulate a merge
summary "Merge branch foo (early part)", a temporary strbuf is used,
but we forgot to deallocate it when we failed to find the named
branch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
eaa4e59
)
diff --git
a/builtin/merge.c
b/builtin/merge.c
index 1d4fbd32885466f59ac018562f1890c441b3ae17..b2d03323cbb8ad382c87f73a134e201f7d8d527f 100644
(file)
--- a/
builtin/merge.c
+++ b/
builtin/merge.c
@@
-491,8
+491,7
@@
static void merge_name(const char *remote, struct strbuf *msg)
}
if (len) {
struct strbuf truname = STRBUF_INIT;
- strbuf_addstr(&truname, "refs/heads/");
- strbuf_addstr(&truname, remote);
+ strbuf_addf(&truname, "refs/heads/%s", remote);
strbuf_setlen(&truname, truname.len - len);
if (ref_exists(truname.buf)) {
strbuf_addf(msg,
@@
-503,6
+502,7
@@
static void merge_name(const char *remote, struct strbuf *msg)
strbuf_release(&truname);
goto cleanup;
}
+ strbuf_release(&truname);
}
if (!strcmp(remote, "FETCH_HEAD") &&