Commit c45dc9c
diff: plug memory leak from regcomp() on {log,diff} -I
Fix a memory leak in 296d4a9 (diff: add -I<regex> that ignores
matching changes, 2020-10-20) by freeing the memory it allocates in
the newly introduced diff_free(). See the previous commit for details
on that.
This memory leak was intentionally introduced in 296d4a9, see the
discussion on a previous iteration of it in
https://lore.kernel.org/git/xmqqeelycajx.fsf@gitster.c.googlers.com/
At that time freeing the memory was somewhat tedious, but since it
isn't anymore with the newly introduced diff_free() let's use it.
Let's retain the pattern for diff_free_file() and add a
diff_free_ignore_regex(), even though (unlike "diff_free_file") we
don't need to call it elsewhere. I think this'll make for more
readable code than gradually accumulating a giant diff_free()
function, sharing "int i" across unrelated code etc.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent e900d49 commit c45dc9c
1 file changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6342 | 6342 | | |
6343 | 6343 | | |
6344 | 6344 | | |
| 6345 | + | |
| 6346 | + | |
| 6347 | + | |
| 6348 | + | |
| 6349 | + | |
| 6350 | + | |
| 6351 | + | |
| 6352 | + | |
| 6353 | + | |
| 6354 | + | |
| 6355 | + | |
6345 | 6356 | | |
6346 | 6357 | | |
6347 | 6358 | | |
6348 | 6359 | | |
6349 | 6360 | | |
6350 | 6361 | | |
| 6362 | + | |
6351 | 6363 | | |
6352 | 6364 | | |
6353 | 6365 | | |
| |||
0 commit comments