[PATCH V2 2/6] line-log.c: fix a memleak
- From
Stefan Beller <sbeller@google.com>
- Date
- Mar 27, 2015, 22:32 UTC
- Message-ID
- <1427495569-10863-3-git-send-email-sbeller@google.com>
- In-Reply-To
- <1427495569-10863-1-git-send-email-sbeller@google.com>
The `filepair` is assigned new memory with any iteration via process_diff_filepair, so free it before the current iteration ends.
Signed-off-by: Stefan Beller <sbeller@google.com> --- line-log.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/line-log.c b/line-log.c index a490efe..b43ac58 100644 --- a/line-log.c +++ b/line-log.c @@ -1099,6 +1099,7 @@ static int process_all_files(struct line_log_data **range_out, rg->pair = diff_filepair_dup(queue->queue[i]); memcpy(&rg->diff, pairdiff, sizeof(struct diff_ranges)); } + free(pairdiff); } return changed;
-- 2.3.0.81.gc37f363