read-cache: free cache entry in add_to_index in case of early return
commit2d9426b049335c1a39be7ea7416094e944bfe63c
authorStefan Beller <sbeller@google.com>
Sat, 21 Mar 2015 00:28:00 +0000 (20 17:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Mar 2015 19:11:25 +0000 (22 12:11 -0700)
tree804bff73de68211cdea205d565cbd63abf9bf4a4
parentfd2014d42b3a4fb865d99e9a7943caa08082cada
read-cache: free cache entry in add_to_index in case of early return

This frees `ce` would be leaking in the error path.

Additionally a free is moved towards the return. This helps code
readability as we often have this pattern of freeing resources just
before return/exit and not in between the code.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c