diff options
| author | punkymaniac <punkymaniac@protonmail.ch> | 2021-06-03 11:21:39 +0200 |
|---|---|---|
| committer | punkymaniac <punkymaniac@protonmail.ch> | 2021-06-03 12:00:02 +0200 |
| commit | 2934b4477a45f7960b62f7bac9301a6f4cc89679 (patch) | |
| tree | e727f37f7035cb4ea78ca17a7401be8c6bcccd8b | |
| parent | 868f4bcb4d3290f4b5320f030fccdf1e7fc8ac8a (diff) | |
| download | libgit2-2934b4477a45f7960b62f7bac9301a6f4cc89679.tar.gz | |
Fix memory leak in git_smart__connect
The call to git_proxy_options_dup will replace the url pointer of the
proxy.
But if the url pointer is already set, the old address will be lost
forever and will never be free.
| -rw-r--r-- | src/transports/smart.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/transports/smart.c b/src/transports/smart.c index da8fe8e22..89ad05b37 100644 --- a/src/transports/smart.c +++ b/src/transports/smart.c @@ -226,6 +226,9 @@ static int git_smart__connect( t->url = git__strdup(url); GIT_ERROR_CHECK_ALLOC(t->url); + if (t->proxy.url) + git_proxy_options_clear(&t->proxy); + if (git_proxy_options_dup(&t->proxy, proxy) < 0) return -1; |
