summaryrefslogtreecommitdiffstats
path: root/builtin/am.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-05 02:03:12 +0200
committerJunio C Hamano <gitster@pobox.com>2017-06-05 02:03:12 +0200
commita207ad7081e42a64f826bd4d5193cecb67c84024 (patch)
treea627c90f3a0f8d32d026a478cbee765648f6d5ae /builtin/am.c
parentMerge branch 'jn/clone-add-empty-config-from-command-line' into maint (diff)
parentam: check return value of resolve_refdup before using hash (diff)
downloadgit-a207ad7081e42a64f826bd4d5193cecb67c84024.tar.xz
git-a207ad7081e42a64f826bd4d5193cecb67c84024.zip
Merge branch 'rs/checkout-am-fix-unborn' into maint
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 4b89289d1e..e39142e4d2 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2148,7 +2148,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);