aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-09-17 11:22:17 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-09-17 11:22:17 +0000
commitdfe33ba624030d36f6bf664c338a7f844007c4b0 (patch)
tree923fd19407c0f5059b9d114a366d46bbd6814544 /src
parent4e401e3ef3ed0027275f366c11f5b67df52ef67d (diff)
downloadgnunet-dfe33ba624030d36f6bf664c338a7f844007c4b0.tar.gz
gnunet-dfe33ba624030d36f6bf664c338a7f844007c4b0.zip
Removed memory leak in curl_logger
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 938a0cc80..726ec4b7e 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -720,12 +720,7 @@ void mhd_logger (void * arg, const char * fmt, va_list ap)
720 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"MHD: %s \n", text); 720 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"MHD: %s \n", text);
721} 721}
722 722
723/** 723
724 * Callback called by MHD when a connection is terminated
725 * @param cls closure
726 * @param connection the terminated connection
727 * @httpSessionCache the mhd session reference
728 */
729static void mhd_termination_cb (void *cls, struct MHD_Connection * connection, void **httpSessionCache) 724static void mhd_termination_cb (void *cls, struct MHD_Connection * connection, void **httpSessionCache)
730{ 725{
731 struct Session * ps = *httpSessionCache; 726 struct Session * ps = *httpSessionCache;
@@ -1435,7 +1430,7 @@ static size_t curl_send_cb(void *stream, size_t size, size_t nmemb, void *ptr)
1435 if ( msg->pos == msg->size) 1430 if ( msg->pos == msg->size)
1436 { 1431 {
1437#if DEBUG_CONNECTIONS 1432#if DEBUG_CONNECTIONS
1438 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos); 1433 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"Connection %X: Message with %u bytes sent, removing message from queue \n",ps, msg->pos);
1439#endif 1434#endif
1440 /* Calling transmit continuation */ 1435 /* Calling transmit continuation */
1441 if (NULL != ps->pending_msgs_tail->transmit_cont) 1436 if (NULL != ps->pending_msgs_tail->transmit_cont)
@@ -1727,9 +1722,9 @@ static int curl_schedule(struct Plugin *plugin)
1727 */ 1722 */
1728int curl_logger (CURL * curl, curl_infotype type , char * data, size_t size , void * cls) 1723int curl_logger (CURL * curl, curl_infotype type , char * data, size_t size , void * cls)
1729{ 1724{
1730 char * text = GNUNET_malloc(size+2);
1731 if (type == CURLINFO_TEXT) 1725 if (type == CURLINFO_TEXT)
1732 { 1726 {
1727 char * text = GNUNET_malloc(size+2);
1733 memcpy(text,data,size); 1728 memcpy(text,data,size);
1734 if (text[size-1] == '\n') 1729 if (text[size-1] == '\n')
1735 text[size] = '\0'; 1730 text[size] = '\0';
@@ -2649,15 +2644,18 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
2649 plugin->bind4_address->sin_family = AF_INET; 2644 plugin->bind4_address->sin_family = AF_INET;
2650 plugin->bind4_address->sin_port = htons (port); 2645 plugin->bind4_address->sin_port = htons (port);
2651 2646
2652 if (inet_pton(AF_INET,plugin->bind_hostname, &plugin->bind4_address->sin_addr)<=0) 2647 if (plugin->bind_hostname!=NULL)
2653 { 2648 {
2654 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2649 if (inet_pton(AF_INET,plugin->bind_hostname, &plugin->bind4_address->sin_addr)<=0)
2655 component_name, 2650 {
2656 _("Misconfigured address to bind to in configuration!\n")); 2651 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2657 GNUNET_free(plugin->bind4_address); 2652 component_name,
2658 GNUNET_free(plugin->bind_hostname); 2653 _("Misconfigured address to bind to in configuration!\n"));
2659 plugin->bind_hostname = NULL; 2654 GNUNET_free(plugin->bind4_address);
2660 plugin->bind4_address = NULL; 2655 GNUNET_free(plugin->bind_hostname);
2656 plugin->bind_hostname = NULL;
2657 plugin->bind4_address = NULL;
2658 }
2661 } 2659 }
2662 } 2660 }
2663 2661
@@ -2673,16 +2671,18 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
2673 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6)); 2671 plugin->bind6_address = GNUNET_malloc(sizeof(struct sockaddr_in6));
2674 plugin->bind6_address->sin6_family = AF_INET6; 2672 plugin->bind6_address->sin6_family = AF_INET6;
2675 plugin->bind6_address->sin6_port = htons (port); 2673 plugin->bind6_address->sin6_port = htons (port);
2676 2674 if (plugin->bind_hostname!=NULL)
2677 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2678 { 2675 {
2679 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2676 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2680 component_name, 2677 {
2681 _("Misconfigured address to bind to in configuration!\n")); 2678 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
2682 GNUNET_free(plugin->bind6_address); 2679 component_name,
2683 GNUNET_free(plugin->bind_hostname); 2680 _("Misconfigured address to bind to in configuration!\n"));
2684 plugin->bind_hostname = NULL; 2681 GNUNET_free(plugin->bind6_address);
2685 plugin->bind6_address = NULL; 2682 GNUNET_free(plugin->bind_hostname);
2683 plugin->bind_hostname = NULL;
2684 plugin->bind6_address = NULL;
2685 }
2686 } 2686 }
2687 } 2687 }
2688 } 2688 }