aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-27 15:50:30 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-29 11:17:43 -0700
commit226406f693013ea3eadab258cb5fc9d8e83df916 (patch)
treec08246838de338afaad76cf758d5099395bae36d /diff.c
parenta00d7d106aa333c4b4d0095f58e05c0c4621bbc2 (diff)
downloadgit-226406f693013ea3eadab258cb5fc9d8e83df916.tar.gz
git-226406f693013ea3eadab258cb5fc9d8e83df916.tar.xz
[PATCH] Introduce diff_free_filepair() funcion.
This introduces a new function to free a common data structure, and plugs some leaks. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/diff.c b/diff.c
index f745cdd6e..680b521a8 100644
--- a/diff.c
+++ b/diff.c
@@ -521,6 +521,13 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue,
return dp;
}
+void diff_free_filepair(struct diff_filepair *p)
+{
+ diff_free_filespec_data(p->one);
+ diff_free_filespec_data(p->two);
+ free(p);
+}
+
static void diff_flush_raw(struct diff_filepair *p,
int line_termination,
int inter_name_termination)
@@ -817,12 +824,8 @@ void diff_flush(int diff_output_style, int resolve_rename_copy)
break;
}
}
- for (i = 0; i < q->nr; i++) {
- struct diff_filepair *p = q->queue[i];
- diff_free_filespec_data(p->one);
- diff_free_filespec_data(p->two);
- free(p);
- }
+ for (i = 0; i < q->nr; i++)
+ diff_free_filepair(q->queue[i]);
free(q->queue);
q->queue = NULL;
q->nr = q->alloc = 0;