From 14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 11 Jun 2024 11:19:22 +0200 Subject: parse-options: fix leaks for users of OPT_FILENAME The `OPT_FILENAME()` option will, if set, put an allocated string into the user-provided variable. Consequently, that variable thus needs to be free'd by the caller of `parse_options()`. Some callsites don't though and thus leak memory. Fix those. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- apply.c | 1 + 1 file changed, 1 insertion(+) (limited to 'apply.c') diff --git a/apply.c b/apply.c index 901b67e625..d8d26a48f1 100644 --- a/apply.c +++ b/apply.c @@ -135,6 +135,7 @@ void clear_apply_state(struct apply_state *state) strset_clear(&state->removed_symlinks); strset_clear(&state->kept_symlinks); strbuf_release(&state->root); + FREE_AND_NULL(state->fake_ancestor); /* &state->fn_table is cleared at the end of apply_patch() */ } -- cgit v1.2.3