author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 6 May 2006 22:02:53 +0000 (00:02 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 7 May 2006 04:36:24 +0000 (21:36 -0700) | ||
commit | 0cc9e70c4c9adb3e79b4a492f2f989c611d85966 | |
tree | 2e23e49ac67b628e433a1b518f9d312b17ab23ed | tree | snapshot |
parent | 22293b9c41778bb60f3b07355e1b8e421a503702 | commit | diff |
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 <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
checkout-index.c | diff | blob | history | |
update-index.c | diff | blob | history |