From: Nicolas Pitre Date: Wed, 10 May 2006 16:26:08 +0000 (-0400) Subject: fix diff-delta bad memory access X-Git-Tag: v1.4.0-rc1~152 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=639ca5497279607665847f2e3a11064441a8f2a6;p=git.git fix diff-delta bad memory access It cannot be assumed that the given buffer will never be moved when shrinking the allocated memory size with realloc(). So let's ignore that optimization for now. This patch makes Electric Fence happy on Linux. Signed-off-by: Nicolas Pitre Acked-by: Linus Torvalds Signed-off-by: Junio C Hamano --- diff --git a/diff-delta.c b/diff-delta.c index c6188751..25a798d0 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -199,7 +199,6 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) entry->next = hash[i]; hash[i] = entry++; hash_count[i]++; - entries--; } } @@ -230,10 +229,6 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) } free(hash_count); - /* If we didn't use all hash entries, free the unused memory. */ - if (entries) - index = realloc(index, memsize - entries * sizeof(*entry)); - return index; }