prefix_path(): unconditionally free results in the callers
authorStefan Beller <sbeller@google.com>
Mon, 4 May 2015 19:11:54 +0000 (12:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 May 2015 17:31:51 +0000 (10:31 -0700)
commitd7a643b73ff4d54e2ad746e3a65a50bf21ac71ce
treea282c59b258def30ab826b5559899ea02c335fd5
parent3d4a3ffe64162b45ae7c991fc60623ecb4678cfd
prefix_path(): unconditionally free results in the callers

As of d089ebaa (setup: sanitize absolute and funny paths in
get_pathspec(), 2008-01-28), prefix_path() always returns a
newly allocated string, so callers should free its result.

Additionally, drop the const from variables to which the result of
the prefix_path() is assigned, so they can be free()'d without
having to cast-away the constness.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout-index.c
builtin/update-index.c