diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/http_client.c | 19 | ||||
| -rw-r--r-- | lib/http_client.h | 2 | 
2 files changed, 12 insertions, 9 deletions
| diff --git a/lib/http_client.c b/lib/http_client.c index b00fcf98..aae5645b 100644 --- a/lib/http_client.c +++ b/lib/http_client.c @@ -58,8 +58,8 @@ void *http_dorequest( char *host, int port, int ssl, char *request, http_input_f  	if( error )  	{ -		g_free( req ); -		return( NULL ); +		http_free( req ); +		return NULL;  	}  	req->func = func; @@ -159,10 +159,7 @@ error:  	req->status_string = g_strdup( "Error while writing HTTP request" );  	req->func( req ); -	 -	g_free( req->request ); -	g_free( req ); -	 +	http_free( req );  	return FALSE;  } @@ -443,11 +440,15 @@ cleanup:  		closesocket( req->fd );  	req->func( req ); -	 +	http_free( req ); +	return FALSE; +} + +void http_free( struct http_request *req ) +{  	g_free( req->request );  	g_free( req->reply_headers );  	g_free( req->status_string );  	g_free( req ); -	 -	return FALSE;  } + diff --git a/lib/http_client.h b/lib/http_client.h index 78d6dbd1..d73894a4 100644 --- a/lib/http_client.h +++ b/lib/http_client.h @@ -80,3 +80,5 @@ struct http_request     are also supported (using ssl_client). */  void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data );  void *http_dorequest_url( char *url_string, http_input_function func, gpointer data ); + +void http_free( struct http_request *req ); | 
