Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
merge: release strbuf after use in save_state()
author
Rene Scharfe
<l.s.r@web.de>
Wed, 30 Aug 2017 17:49:49 +0000
(19:49 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 6 Sep 2017 23:49:28 +0000
(08:49 +0900)
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
400cd6b
)
diff --git
a/builtin/merge.c
b/builtin/merge.c
index 7df3fe3927ef8a1c65f7baad7d957602436315cd..4f8418246be92732bbfdcd742b56a178d57119e2 100644
(file)
--- a/
builtin/merge.c
+++ b/
builtin/merge.c
@@
-253,6
+253,7
@@
static int save_state(struct object_id *stash)
struct child_process cp = CHILD_PROCESS_INIT;
struct strbuf buffer = STRBUF_INIT;
const char *argv[] = {"stash", "create", NULL};
struct child_process cp = CHILD_PROCESS_INIT;
struct strbuf buffer = STRBUF_INIT;
const char *argv[] = {"stash", "create", NULL};
+ int rc = -1;
cp.argv = argv;
cp.out = -1;
cp.argv = argv;
cp.out = -1;
@@
-266,11
+267,14
@@
static int save_state(struct object_id *stash)
if (finish_command(&cp) || len < 0)
die(_("stash failed"));
else if (!len) /* no changes */
if (finish_command(&cp) || len < 0)
die(_("stash failed"));
else if (!len) /* no changes */
-
return -1
;
+
goto out
;
strbuf_setlen(&buffer, buffer.len-1);
if (get_oid(buffer.buf, stash))
die(_("not a valid object: %s"), buffer.buf);
strbuf_setlen(&buffer, buffer.len-1);
if (get_oid(buffer.buf, stash))
die(_("not a valid object: %s"), buffer.buf);
- return 0;
+ rc = 0;
+out:
+ strbuf_release(&buffer);
+ return rc;
}
static void read_empty(unsigned const char *sha1, int verbose)
}
static void read_empty(unsigned const char *sha1, int verbose)