aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-14 14:06:50 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-14 14:06:50 -0700
commit19397b4521bcc27eb224413fb71519223b94290f (patch)
tree457823789014c2986aee9379f936d7025b54dad1 /diff.c
parent705a7148ba1bb9597b1837b7f64a0dcb67f1ad0c (diff)
downloadgit-19397b4521bcc27eb224413fb71519223b94290f.tar.gz
Revert "[PATCH] plug memory leak in diff.c::diff_free_filepair()"
This reverts 068eac91ce04b9aca163acb1927c3878c45d1a07 commit.
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/diff.c b/diff.c
index 1059049fb9..05a0663d4d 100644
--- a/diff.c
+++ b/diff.c
@@ -402,13 +402,14 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
return 0;
}
-void diff_free_filespec(struct diff_filespec *s)
+void diff_free_filespec_data(struct diff_filespec *s)
{
if (s->should_free)
free(s->data);
else if (s->should_munmap)
munmap(s->data, s->size);
- free(s);
+ s->should_free = s->should_munmap = 0;
+ s->data = NULL;
}
static void prep_temp_blob(struct diff_tempfile *temp,
@@ -767,8 +768,8 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue,
void diff_free_filepair(struct diff_filepair *p)
{
- diff_free_filespec(p->one);
- diff_free_filespec(p->two);
+ diff_free_filespec_data(p->one);
+ diff_free_filespec_data(p->two);
free(p);
}