checkout: check return value of resolve_refdup before using hash
authorRené Scharfe <l.s.r@web.de>
Sat, 6 May 2017 17:13:52 +0000 (19:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2017 02:12:09 +0000 (11:12 +0900)
If resolve_refdup() fails it returns NULL and possibly leaves its hash
output parameter untouched. Make sure to use it only if the function
succeeded, in order to avoid accessing uninitialized memory.

Found with t/t2011-checkout-invalid-head.sh --valgrind.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found