From: Jacob Keller Date: Mon, 23 Jun 2025 23:11:30 +0000 (-0700) Subject: remote: fix tear down of struct remote X-Git-Tag: v2.51.0-rc0~95^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2084f119b4d8252116493336f597d205cfa8f0b8;p=thirdparty%2Fgit.git remote: fix tear down of struct remote The remote_clear() function failed to free the remote->push and remote->fetch refspec fields. This should be caught by the leak sanitizer. However, for callers which use ``the_repository``, the values never go out of scope and the sanitizer doesn't complain. A future change is going to add a caller of read_config() for a submodule repository structure, which would result in the leak sanitizer complaining. Fix remote_clear(), updating it to properly call refspec_clear() for both the push and fetch members. Signed-off-by: Jacob Keller Signed-off-by: Junio C Hamano --- diff --git a/remote.c b/remote.c index ee95126f3f..194bb44778 100644 --- a/remote.c +++ b/remote.c @@ -165,6 +165,9 @@ static void remote_clear(struct remote *remote) strvec_clear(&remote->url); strvec_clear(&remote->pushurl); + refspec_clear(&remote->push); + refspec_clear(&remote->fetch); + free((char *)remote->receivepack); free((char *)remote->uploadpack); FREE_AND_NULL(remote->http_proxy);