Commit 8bd1c19e by Bob Kuo

Free allocated pointer to curl stream on error

parent 0f9d1549
...@@ -207,11 +207,14 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port) ...@@ -207,11 +207,14 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port)
handle = curl_easy_init(); handle = curl_easy_init();
if (handle == NULL) { if (handle == NULL) {
giterr_set(GITERR_NET, "failed to create curl handle"); giterr_set(GITERR_NET, "failed to create curl handle");
git__free(st);
return -1; 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; return error;
}
curl_easy_setopt(handle, CURLOPT_URL, host); curl_easy_setopt(handle, CURLOPT_URL, host);
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, st->curl_error); curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, st->curl_error);
......
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