Skip to content

Commit 2084f11

Browse files
jacob-kellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f62dcc7 commit 2084f11

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

remote.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ static void remote_clear(struct remote *remote)
165165
strvec_clear(&remote->url);
166166
strvec_clear(&remote->pushurl);
167167

168+
refspec_clear(&remote->push);
169+
refspec_clear(&remote->fetch);
170+
168171
free((char *)remote->receivepack);
169172
free((char *)remote->uploadpack);
170173
FREE_AND_NULL(remote->http_proxy);

0 commit comments

Comments
 (0)