Skip to content

Commit

Permalink
fix diff-delta bad memory access
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed May 10, 2006
1 parent f7a3276 commit 639ca54
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions diff-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 639ca54

Please sign in to comment.