[Freeswitch-svn] [commit] r7846 - freeswitch/trunk/src/mod/xml_int/mod_xml_cdr

Freeswitch SVN mikej at freeswitch.org
Sat Mar 8 16:08:00 EST 2008


Author: mikej
Date: Sat Mar  8 16:08:00 2008
New Revision: 7846

Modified:
   freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

Log:
silly rabbit, leaks are for kids.

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	Sat Mar  8 16:08:00 2008
@@ -73,6 +73,8 @@
 	uint32_t cur_try;
 	long httpRes;
 	CURL *curl_handle = NULL;
+	struct curl_slist *headers = NULL;
+	struct curl_slist *slist = NULL;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -121,8 +123,6 @@
 
 	/* try to post it to the web server */
 	if (!switch_strlen_zero(globals.url)) {
-		struct curl_slist *headers = NULL;
-		struct curl_slist *slist = NULL;
 		curl_handle = curl_easy_init();
 		
 		if (globals.encode) {
@@ -189,6 +189,9 @@
 		}
 		curl_easy_cleanup(curl_handle);
 		curl_slist_free_all(headers);
+		curl_slist_free_all(slist);
+		slist = NULL;
+		headers = NULL;
 		curl_handle = NULL;
 
 		/* if we are here the web post failed for some reason */
@@ -222,6 +225,12 @@
 	if (curl_handle) {	
 		curl_easy_cleanup(curl_handle);
 	}
+	if (headers) {
+		curl_slist_free_all(headers);
+	}
+	if (slist) {
+		curl_slist_free_all(slist);
+	}
 	switch_safe_free(curl_xml_text);
 	switch_safe_free(xml_text);
 	switch_safe_free(path);



More information about the Freeswitch-svn mailing list