# \[PATCH V2 2/6\] line-log.c: fix a memleak

- From: Stefan Beller \<hidden\>
- Date: 2016-06-15 23:04:18 
- List: git
- Page: https://ratatoskr.run/git/2016/06/7652902
- Thread: https://ratatoskr.run/git/2016/06/7652901/t.md

```text
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 <redacted>
---
 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
```
