add_delta_base_cache: use list_for_each_safe
commit4b92bae7d363adfe923337f198f9c98dc1c68e27
authorJeff King <peff@peff.net>
Mon, 12 Sep 2016 16:46:17 +0000 (12 12:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Sep 2016 19:09:41 +0000 (12 12:09 -0700)
treee6ba67e050ccd65e8baf5ffcfa6b08c0ee7c4bbb
parentc7df68cbca75232f7843a7d70c58a0e98decef91
add_delta_base_cache: use list_for_each_safe

We may remove elements from the list while we are iterating,
which requires using a second temporary pointer. Otherwise
stepping to the next element of the list might involve
looking at freed memory (which generally works in practice,
as we _just_ freed it, but of course is wrong to rely on;
valgrind notices it).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c