diff options
author | René Scharfe <l.s.r@web.de> | 2017-12-07 21:20:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-07 21:30:04 +0100 |
commit | 1b09073514085c51bbd2884122af60a45b24db5d (patch) | |
tree | cd30997a6732a6abb66d08707abc8fe8bfa4199e | |
parent | git-am: add am.threeWay config variable (diff) | |
download | git-1b09073514085c51bbd2884122af60a45b24db5d.tar.xz git-1b09073514085c51bbd2884122af60a45b24db5d.zip |
am: release strbuf after use in split_mail_mbox()
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/am.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c index 1399c8dd88..2368853763 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -702,6 +702,7 @@ static int split_mail_mbox(struct am_state *state, const char **paths, int keep_ { struct child_process cp = CHILD_PROCESS_INIT; struct strbuf last = STRBUF_INIT; + int ret; cp.git_cmd = 1; argv_array_push(&cp.args, "mailsplit"); @@ -713,13 +714,16 @@ static int split_mail_mbox(struct am_state *state, const char **paths, int keep_ argv_array_push(&cp.args, "--"); argv_array_pushv(&cp.args, paths); - if (capture_command(&cp, &last, 8)) - return -1; + ret = capture_command(&cp, &last, 8); + if (ret) + goto exit; state->cur = 1; state->last = strtol(last.buf, NULL, 10); - return 0; +exit: + strbuf_release(&last); + return ret ? -1 : 0; } /** |