Skip to content
Snippets Groups Projects
Commit 868488b5 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

memory leak cleanup campaign

parent 7f77a061
No related branches found
No related tags found
No related merge requests found
......@@ -620,7 +620,7 @@ CURLcode curl_transfer(CURL *curl)
{
CURLcode res;
struct UrlData *data = curl;
struct connectdata *c_connect;
struct connectdata *c_connect=NULL;
pgrsStartNow(data);
......
......@@ -390,6 +390,7 @@ CURLcode http(struct connectdata *conn)
if(co) {
int count=0;
struct Cookie *store=co;
/* now loop through all cookies that matched */
while(co) {
if(co->value && strlen(co->value)) {
......@@ -405,7 +406,7 @@ CURLcode http(struct connectdata *conn)
if(count) {
add_buffer(req_buffer, "\r\n", 2);
}
cookie_freelist(co); /* free the cookie list */
cookie_freelist(store); /* free the cookie list */
co=NULL;
}
......
......@@ -685,26 +685,7 @@ CURLcode curl_disconnect(CURLconnect *c_connect)
return CURLE_OK;
}
/*
* NAME curl_connect()
*
* DESCRIPTION
*
* Connects to the peer server and performs the initial setup. This function
* writes a connect handle to its second argument that is a unique handle for
* this connect. This allows multiple connects from the same handle returned
* by curl_open().
*
* EXAMPLE
*
* CURLCode result;
* CURL curl;
* CURLconnect connect;
* result = curl_connect(curl, &connect);
*/
CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
{
char *tmp;
char *buf;
......@@ -1537,6 +1518,50 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
return CURLE_OK;
}
CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
{
CURLcode code;
struct connectdata *conn;
/* call the stuff that needs to be called */
code = _connect(curl, in_connect);
if(CURLE_OK != code) {
/* We're not allowed to return failure with memory left allocated
in the connectdata struct, free those here */
conn = (struct connectdata *)*in_connect;
if(conn) {
if(conn->hostent_buf)
free(conn->hostent_buf);
free(conn);
*in_connect=NULL;
}
}
return code;
}
/*
* NAME curl_connect()
*
* DESCRIPTION
*
* Connects to the peer server and performs the initial setup. This function
* writes a connect handle to its second argument that is a unique handle for
* this connect. This allows multiple connects from the same handle returned
* by curl_open().
*
* EXAMPLE
*
* CURLCode result;
* CURL curl;
* CURLconnect connect;
* result = curl_connect(curl, &connect);
*/
CURLcode curl_done(CURLconnect *c_connect)
{
struct connectdata *conn = c_connect;
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment