diff options
| author | Bob Kuo <bobjkuo@gmail.com> | 2016-01-16 19:39:24 -0600 |
|---|---|---|
| committer | Bob Kuo <bobjkuo@gmail.com> | 2016-01-16 19:39:24 -0600 |
| commit | 8bd1c19e767c85f4e2cc035068bb3146247e27fb (patch) | |
| tree | 5dfba981a0e56a3e27d3e526d18f20815d1f411e | |
| parent | 0f9d15493d5d8ad4353dd7beed52c9567334f6e5 (diff) | |
| download | libgit2-8bd1c19e767c85f4e2cc035068bb3146247e27fb.tar.gz | |
Free allocated pointer to curl stream on error
| -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); |
