Commit 21e6a11a by Edward Thomson Committed by GitHub

Merge pull request #4359 from libgit2/cmn/proxy-options-free

Plug some leaks in curl's proxy handling
parents 58deac77 25fdb3f0
...@@ -195,6 +195,7 @@ static int curls_set_proxy(git_stream *stream, const git_proxy_options *proxy_op ...@@ -195,6 +195,7 @@ static int curls_set_proxy(git_stream *stream, const git_proxy_options *proxy_op
CURLcode res; CURLcode res;
curl_stream *s = (curl_stream *) stream; curl_stream *s = (curl_stream *) stream;
git_proxy_options_clear(&s->proxy);
if ((error = git_proxy_options_dup(&s->proxy, proxy_opts)) < 0) if ((error = git_proxy_options_dup(&s->proxy, proxy_opts)) < 0)
return error; return error;
...@@ -295,6 +296,8 @@ static void curls_free(git_stream *stream) ...@@ -295,6 +296,8 @@ static void curls_free(git_stream *stream)
curls_close(stream); curls_close(stream);
git_strarray_free(&s->cert_info_strings); git_strarray_free(&s->cert_info_strings);
git_proxy_options_clear(&s->proxy);
git_cred_free(s->proxy_cred);
git__free(s); git__free(s);
} }
......
...@@ -31,3 +31,9 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src) ...@@ -31,3 +31,9 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
return 0; return 0;
} }
void git_proxy_options_clear(git_proxy_options *opts)
{
git__free((char *) opts->url);
opts->url = NULL;
}
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
#include "git2/proxy.h" #include "git2/proxy.h"
extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src); extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
extern void git_proxy_options_clear(git_proxy_options *opts);
#endif #endif
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