Skip to content

Commit ec9b74b

Browse files
rjustogitster
authored andcommitted
add-patch: plug a leak handling the '/' command
Plug a leak we have since d6cf873 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5861aa8 commit ec9b74b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

add-patch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,7 @@ static int patch_update_file(struct add_p_state *s,
16461646
err(s, _("No hunk matches the given pattern"));
16471647
break;
16481648
}
1649+
regfree(&regex);
16491650
hunk_index = i;
16501651
} else if (s->answer.buf[0] == 's') {
16511652
size_t splittable_into = hunk->splittable_into;

0 commit comments

Comments
 (0)