From 355b3190ee208594ab122eace8a20f17d668e21c Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 26 Sep 2024 13:46:57 +0200 Subject: promisor-remote: fix leaking partial clone filter The partial clone filter of a promisor remote is never free'd, causing memory leaks. Furthermore, in case multiple partial clone filters are defined for the same remote, we'd overwrite previous values without freeing them. Fix these leaks. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- promisor-remote.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'promisor-remote.c') diff --git a/promisor-remote.c b/promisor-remote.c index 317e1b127f..9345ae3db2 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -154,6 +154,7 @@ static int promisor_remote_config(const char *var, const char *value, if (!r) return 0; + FREE_AND_NULL(r->partial_clone_filter); return git_config_string(&r->partial_clone_filter, var, value); } @@ -189,6 +190,7 @@ void promisor_remote_clear(struct promisor_remote_config *config) { while (config->promisors) { struct promisor_remote *r = config->promisors; + free(r->partial_clone_filter); config->promisors = config->promisors->next; free(r); } -- cgit v1.2.3