memory leak cleanup campaign
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
65
lib/url.c
65
lib/url.c
@@ -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;
|
||||
|
Reference in New Issue
Block a user