From 639ca5497279607665847f2e3a11064441a8f2a6 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 10 May 2006 12:26:08 -0400 Subject: [PATCH] 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-delta.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/diff-delta.c b/diff-delta.c index c61887518..25a798d05 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; } -- 2.26.2