aboutsummaryrefslogtreecommitdiff
path: root/diff-delta.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-05-10 12:26:08 -0400
committerJunio C Hamano <junkio@cox.net>2006-05-10 10:53:59 -0700
commit639ca5497279607665847f2e3a11064441a8f2a6 (patch)
tree85e5fd0d2435d34fa42d1a96840fca8d267aa6bb /diff-delta.c
parentf7a3276bab880222e3117f8b8cbef40920dfe884 (diff)
downloadgit-639ca5497279607665847f2e3a11064441a8f2a6.tar.gz
git-639ca5497279607665847f2e3a11064441a8f2a6.tar.xz
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 <nico@cam.org> Acked-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff-delta.c')
-rw-r--r--diff-delta.c5
1 files changed, 0 insertions, 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;
}