gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13010 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r13010 - gnunet/src/transport
Date: Fri, 17 Sep 2010 13:22:17 +0200

Author: wachs
Date: 2010-09-17 13:22:17 +0200 (Fri, 17 Sep 2010)
New Revision: 13010

Modified:
   gnunet/src/transport/plugin_transport_http.c
Log:
Removed memory leak in curl_logger


Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c        2010-09-16 15:20:40 UTC 
(rev 13009)
+++ gnunet/src/transport/plugin_transport_http.c        2010-09-17 11:22:17 UTC 
(rev 13010)
@@ -720,12 +720,7 @@
        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"MHD: %s \n", text);
 }
 
-/**
- * Callback called by MHD when a connection is terminated
- * @param cls closure
- * @param connection the terminated connection
- * @httpSessionCache the mhd session reference
- */
+
 static void mhd_termination_cb (void *cls, struct MHD_Connection * connection, 
void **httpSessionCache)
 {
   struct Session * ps = *httpSessionCache;
@@ -1435,7 +1430,7 @@
   if ( msg->pos == msg->size)
   {
 #if DEBUG_CONNECTIONS
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Message with %u bytes 
sent, removing message from queue \n",ps, msg->pos);
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"Connection %X: Message with %u 
bytes sent, removing message from queue \n",ps, msg->pos);
 #endif
     /* Calling transmit continuation  */
     if (NULL != ps->pending_msgs_tail->transmit_cont)
@@ -1727,9 +1722,9 @@
  */
 int curl_logger (CURL * curl, curl_infotype type , char * data, size_t size , 
void * cls)
 {
-       char * text = GNUNET_malloc(size+2);
        if (type == CURLINFO_TEXT)
        {
+               char * text = GNUNET_malloc(size+2);
                memcpy(text,data,size);
                if (text[size-1] == '\n')
                        text[size] = '\0';
@@ -2649,15 +2644,18 @@
          plugin->bind4_address->sin_family = AF_INET;
          plugin->bind4_address->sin_port = htons (port);
 
-         if (inet_pton(AF_INET,plugin->bind_hostname, 
&plugin->bind4_address->sin_addr)<=0)
+         if (plugin->bind_hostname!=NULL)
          {
-                 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
-                                                  component_name,
-                                                  _("Misconfigured address to 
bind to in configuration!\n"));
-                 GNUNET_free(plugin->bind4_address);
-                 GNUNET_free(plugin->bind_hostname);
-                 plugin->bind_hostname = NULL;
-                 plugin->bind4_address = NULL;
+                 if (inet_pton(AF_INET,plugin->bind_hostname, 
&plugin->bind4_address->sin_addr)<=0)
+                 {
+                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                                                          component_name,
+                                                          _("Misconfigured 
address to bind to in configuration!\n"));
+                         GNUNET_free(plugin->bind4_address);
+                         GNUNET_free(plugin->bind_hostname);
+                         plugin->bind_hostname = NULL;
+                         plugin->bind4_address = NULL;
+                 }
          }
   }
 
@@ -2673,16 +2671,18 @@
                  plugin->bind6_address = GNUNET_malloc(sizeof(struct 
sockaddr_in6));
                  plugin->bind6_address->sin6_family = AF_INET6;
                  plugin->bind6_address->sin6_port = htons (port);
-
-                 if (inet_pton(AF_INET6,plugin->bind_hostname, 
&plugin->bind6_address->sin6_addr)<=0)
+                 if (plugin->bind_hostname!=NULL)
                  {
-                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
-                                                          component_name,
-                                                          _("Misconfigured 
address to bind to in configuration!\n"));
-                         GNUNET_free(plugin->bind6_address);
-                         GNUNET_free(plugin->bind_hostname);
-                         plugin->bind_hostname = NULL;
-                         plugin->bind6_address = NULL;
+                         if (inet_pton(AF_INET6,plugin->bind_hostname, 
&plugin->bind6_address->sin6_addr)<=0)
+                         {
+                                 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                                                                  
component_name,
+                                                                  
_("Misconfigured address to bind to in configuration!\n"));
+                                 GNUNET_free(plugin->bind6_address);
+                                 GNUNET_free(plugin->bind_hostname);
+                                 plugin->bind_hostname = NULL;
+                                 plugin->bind6_address = NULL;
+                         }
                  }
          }
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]