]> Kevux Git Server - rit/commitdiff
line-log: free the diff queues' arrays when processing merge commits
authorSZEDER Gábor <szeder.dev@gmail.com>
Wed, 2 Nov 2022 22:01:41 +0000 (23:01 +0100)
committerTaylor Blau <me@ttaylorr.com>
Thu, 3 Nov 2022 00:16:34 +0000 (20:16 -0400)
When processing merge commits, the line-level log first creates an
array of diff queues, each comparing the merge commit with one of its
parents, to check whether any of the files in the given line ranges
were modified.  Alas, when freeing these queues it only frees the
filepairs in the queues, but not the queues' internal arrays holding
pointers to those filepairs.

Use the diff_free_queue() helper function introduced in the previous
commit to free the diff queues' internal arrays as well.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
line-log.c

index 7a74daf..a7f3e7f 100644 (file)
@@ -1089,10 +1089,8 @@ static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)
 
 static void free_diffqueues(int n, struct diff_queue_struct *dq)
 {
-       int i, j;
-       for (i = 0; i < n; i++)
-               for (j = 0; j < dq[i].nr; j++)
-                       diff_free_filepair(dq[i].queue[j]);
+       for (int i = 0; i < n; i++)
+               diff_free_queue(&dq[i]);
        free(dq);
 }