Commit ffc12e66 by 7Ji

remote: fix memory leak in git_remote_download()

connect_opts is created with its custom_headers and proxy_opts->url possibly
allocated on heap, just like in git_remote_fetch(). But unlike in
_fetch(), it is not disposed at the end of the function, thus causing
memory leak.
parent 45fd9ed7
......@@ -1339,7 +1339,11 @@ int git_remote_download(
if ((error = connect_or_reset_options(remote, GIT_DIRECTION_FETCH, &connect_opts)) < 0)
return error;
return git_remote__download(remote, refspecs, opts);
error = git_remote__download(remote, refspecs, opts);
git_remote_connect_options_dispose(&connect_opts);
return error;
}
int git_remote_fetch(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment