diff options
| author | Carlos Martín Nieto <carlosmn@github.com> | 2016-02-05 15:19:24 -0800 |
|---|---|---|
| committer | Carlos Martín Nieto <carlosmn@github.com> | 2016-02-05 15:19:24 -0800 |
| commit | 240b6fed0075ae33e1ebc390c25d7503b2f18fb1 (patch) | |
| tree | b68dfe5c5c33fbf5fd1f6f7dc5c775640a795b01 /src | |
| parent | efa8208c73b6da7c8142ec6fdbd5fa2046898259 (diff) | |
| parent | 8bd1c19e767c85f4e2cc035068bb3146247e27fb (diff) | |
| download | libgit2-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.c | 5 |
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); |
