aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRubén Justo <rjusto@gmail.com>2024-04-23 00:54:14 +0200
committerJunio C Hamano <gitster@pobox.com>2024-04-22 16:27:42 -0700
commitec9b74b18e019a8adff827ab22380f9771ac5f00 (patch)
treefd272b3055c6c9ad2a3e88b9dc5952dec8bd471e
parent5861aa84a7a5f393e953203068bd3fc5c710fc42 (diff)
downloadgit-ec9b74b18e019a8adff827ab22380f9771ac5f00.tar.gz
add-patch: plug a leak handling the '/' command
Plug a leak we have since d6cf873340 (built-in add -p: implement the '/' ("search regex") command, 2019-12-13). This leak can be triggered with: $ printf "A\n\nB\n" >file $ git add file && git commit -m file $ printf "AA\n\nBB\n" >file $ printf "s\n/ .\n" >lines $ git add -p <lines Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--add-patch.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/add-patch.c b/add-patch.c
index a06dd18985..0997d4af73 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1646,6 +1646,7 @@ soft_increment:
err(s, _("No hunk matches the given pattern"));
break;
}
+ regfree(&regex);
hunk_index = i;
} else if (s->answer.buf[0] == 's') {
size_t splittable_into = hunk->splittable_into;