summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-23 04:46:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-23 04:46:05 (GMT)
commite40c0f428837d9a1e23dc711b0632c99455810af (patch)
treef84771a6365c7d7470421e15a786ca15aa6264aa /builtin/am.c
parentdcad9a4c87daa4c90d5504e87973d2d5a5d31ff4 (diff)
parent57e0ef0e0e90c4cb72c35db874fc3d035b88ce4d (diff)
downloadgit-e40c0f428837d9a1e23dc711b0632c99455810af.zip
git-e40c0f428837d9a1e23dc711b0632c99455810af.tar.gz
git-e40c0f428837d9a1e23dc711b0632c99455810af.tar.bz2
Merge branch 'rs/checkout-am-fix-unborn'
A few codepaths in "checkout" and "am" working on an unborn branch tried to access an uninitialized piece of memory. * rs/checkout-am-fix-unborn: am: check return value of resolve_refdup before using hash checkout: check return value of resolve_refdup before using hash
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/am.c b/builtin/am.c
index a63935c..8e9ac11 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2150,7 +2150,7 @@ static void am_abort(struct am_state *state)
am_rerere_clear();
curr_branch = resolve_refdup("HEAD", 0, curr_head.hash, NULL);
- has_curr_head = !is_null_oid(&curr_head);
+ has_curr_head = curr_branch && !is_null_oid(&curr_head);
if (!has_curr_head)
hashcpy(curr_head.hash, EMPTY_TREE_SHA1_BIN);