summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-02-05 15:19:24 -0800
committerCarlos Martín Nieto <carlosmn@github.com>2016-02-05 15:19:24 -0800
commit240b6fed0075ae33e1ebc390c25d7503b2f18fb1 (patch)
treeb68dfe5c5c33fbf5fd1f6f7dc5c775640a795b01 /src
parentefa8208c73b6da7c8142ec6fdbd5fa2046898259 (diff)
parent8bd1c19e767c85f4e2cc035068bb3146247e27fb (diff)
downloadlibgit2-240b6fed0075ae33e1ebc390c25d7503b2f18fb1.tar.gz
Merge pull request #3578 from bubaflub/fix_small_memory_leak
Free allocated pointer to curl stream on error
Diffstat (limited to 'src')
-rw-r--r--src/curl_stream.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/curl_stream.c b/src/curl_stream.c
index 798bd5a52..9f8b202a8 100644
--- a/src/curl_stream.c
+++ b/src/curl_stream.c
@@ -207,11 +207,14 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port)
handle = curl_easy_init();
if (handle == NULL) {
giterr_set(GITERR_NET, "failed to create curl handle");
+ git__free(st);
return -1;
}
- if ((error = git__strtol32(&iport, port, NULL, 10)) < 0)
+ if ((error = git__strtol32(&iport, port, NULL, 10)) < 0) {
+ git__free(st);
return error;
+ }
curl_easy_setopt(handle, CURLOPT_URL, host);
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, st->curl_error);