X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff.c;h=137d0d0c0c3eaaaa1c3c874c6e5f719e00a0d396;hb=4f7599ac2543e1d59f2b2b865ecff272ae5f4ea5;hp=3e52fec18792056e230420bdeabff0f9dab5b35a;hpb=e8c80638abc99928dba9ac832589749a531e2e21;p=git.git diff --git a/diff.c b/diff.c index 3e52fec1..137d0d0c 100644 --- a/diff.c +++ b/diff.c @@ -405,14 +405,13 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) return 0; } -void diff_free_filespec_data(struct diff_filespec *s) +void diff_free_filespec(struct diff_filespec *s) { if (s->should_free) free(s->data); else if (s->should_munmap) munmap(s->data, s->size); - s->should_free = s->should_munmap = 0; - s->data = NULL; + free(s); } static void prep_temp_blob(struct diff_tempfile *temp, @@ -769,8 +768,8 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *queue, void diff_free_filepair(struct diff_filepair *p) { - diff_free_filespec_data(p->one); - diff_free_filespec_data(p->two); + diff_free_filespec(p->one); + diff_free_filespec(p->two); free(p); } @@ -1011,9 +1010,8 @@ void diff_flush(int diff_output_style, int line_termination) diff_flush_name(p, line_termination); break; } - } - for (i = 0; i < q->nr; i++) diff_free_filepair(q->queue[i]); + } free(q->queue); q->queue = NULL; q->nr = q->alloc = 0;