summaryrefslogtreecommitdiff
path: root/builtin-rerere.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-03 21:52:14 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-03 21:52:14 -0700
commit045f5759c97746589a067461e50fad16f60711ac (patch)
tree3eaaef6c395bbe17ca26620dc98fb6b128721640 /builtin-rerere.c
parent04483524ecfe67e4d4f120b0bf6d91b43a02d40a (diff)
parent9694ec4533b30c1299e9ce7742c65c78b4fa3c5d (diff)
downloadgit-045f5759c97746589a067461e50fad16f60711ac.tar.gz
Merge 1.5.0.7 in
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-rerere.c')
-rw-r--r--builtin-rerere.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index b8867ab4ad..b463c07f04 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -78,6 +78,13 @@ static void append_line(struct buffer *buffer, const char *line)
buffer->nr += len;
}
+static void clear_buffer(struct buffer *buffer)
+{
+ free(buffer->ptr);
+ buffer->ptr = NULL;
+ buffer->nr = buffer->alloc = 0;
+}
+
static int handle_file(const char *path,
unsigned char *sha1, const char *output)
{
@@ -131,6 +138,8 @@ static int handle_file(const char *path,
SHA1_Update(&ctx, two->ptr, two->nr);
SHA1_Update(&ctx, "\0", 1);
}
+ clear_buffer(one);
+ clear_buffer(two);
} else if (hunk == 1)
append_line(one, buf);
else if (hunk == 2)