diff --git a/diff.c b/diff.c index 35e46dd968..ef94175163 100644 --- a/diff.c +++ b/diff.c @@ -5773,6 +5773,13 @@ void diff_free_filepair(struct diff_filepair *p) free(p); } +void diff_free_queue(struct diff_queue_struct *q) +{ + for (int i = 0; i < q->nr; i++) + diff_free_filepair(q->queue[i]); + free(q->queue); +} + const char *diff_aligned_abbrev(const struct object_id *oid, int len) { int abblen; diff --git a/diffcore.h b/diffcore.h index badc2261c2..9b588a1ee1 100644 --- a/diffcore.h +++ b/diffcore.h @@ -162,6 +162,7 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *, struct diff_filespec *, struct diff_filespec *); void diff_q(struct diff_queue_struct *, struct diff_filepair *); +void diff_free_queue(struct diff_queue_struct *q); /* dir_rename_relevance: the reason we want rename information for a dir */ enum dir_rename_relevance { diff --git a/line-log.c b/line-log.c index 51d93310a4..7a74daf2e8 100644 --- a/line-log.c +++ b/line-log.c @@ -1195,6 +1195,7 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c if (parent) add_line_range(rev, parent, parent_range); free_line_log_data(parent_range); + diff_free_queue(&queue); return changed; }