diff mbox series

[v2,26/29] line-range: plug leaking find functions

Message ID 67f8637dc66530f05678f327d18370b524448481.1718095906.git.ps@pks.im (mailing list archive)
State Accepted
Commit 4b4f5a911c4d2fedf4620ff079dcb2a5a0edccc7
Headers show
Series Memory leak fixes (pt.2) | expand

Commit Message

Patrick Steinhardt June 11, 2024, 9:21 a.m. UTC
In `parse_range_funcname()` we may end up allocating a "find function",
but never free it. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 line-range.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/line-range.c b/line-range.c
index 60f0e5ada8..b99f0d9895 100644
--- a/line-range.c
+++ b/line-range.c
@@ -234,6 +234,8 @@  static const char *parse_range_funcname(
 	}
 
 	regfree(&regexp);
+	if (xecfg)
+		xdiff_clear_find_func(xecfg);
 	free(xecfg);
 	free(pattern);