From: Johannes Schindelin Date: Sat, 6 May 2006 22:02:53 +0000 (+0200) Subject: Fix users of prefix_path() to free() only when necessary X-Git-Tag: v1.4.0-rc1~164 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/be65e7d9fbd3ae6fc097cedade2afe39805fcf4e?ds=inline;hp=be65e7d9fbd3ae6fc097cedade2afe39805fcf4e Fix users of prefix_path() to free() only when necessary Unfortunately, prefix_path() sometimes returns a newly xmalloc()ed buffer, and in other cases it returns a substring! For example, when calling git update-index ./hello.txt prefix_path() returns "hello.txt", but does not allocate a new buffer. The original code only checked if the result of prefix_path() was different from what was passed in, and thusly trigger a segmentation fault. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano ---