gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29068 - in gnunet/src: fs gns hostlist identity include na


From: gnunet
Subject: [GNUnet-SVN] r29068 - in gnunet/src: fs gns hostlist identity include namestore regex
Date: Fri, 6 Sep 2013 14:05:24 +0200

Author: grothoff
Date: 2013-09-06 14:05:24 +0200 (Fri, 06 Sep 2013)
New Revision: 29068

Modified:
   gnunet/src/fs/gnunet-publish.c
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/hostlist/hostlist-server.c
   gnunet/src/identity/gnunet-identity.c
   gnunet/src/include/gnunet_namestore_service.h
   gnunet/src/namestore/gnunet-namestore-fcfsd.c
   gnunet/src/namestore/gnunet-service-namestore.c
   gnunet/src/namestore/namestore_api_common.c
   gnunet/src/regex/regex_api.c
Log:
-misc fixes

Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c      2013-09-06 12:02:10 UTC (rev 29067)
+++ gnunet/src/fs/gnunet-publish.c      2013-09-06 12:05:24 UTC (rev 29068)
@@ -669,6 +669,7 @@
             _("Failed to access `%s': %s\n"),
             args0,
             STRERROR (errno));
+    GNUNET_free_non_null (ex);
     return;
   }
   ds = GNUNET_FS_directory_scan_start (args0,
@@ -679,8 +680,10 @@
   {
     FPRINTF (stderr,
             "%s", _("Failed to start meta directory scanner.  Is 
gnunet-helper-publish-fs installed?\n"));
+    GNUNET_free_non_null (ex);
     return;
   }
+  GNUNET_free_non_null (ex);
 }
 
 

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2013-09-06 12:02:10 UTC 
(rev 29067)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2013-09-06 12:05:24 UTC 
(rev 29068)
@@ -727,6 +727,7 @@
       GNUNET_free (rh->name);
       rh->name = GNUNET_strdup (p->answers[0].data.hostname);
       start_resolver_lookup (rh);
+      GNUNET_DNSPARSER_free_packet (p);
       return;     
     }
   /* FIXME: add DNAME support */
@@ -1195,8 +1196,8 @@
              rd_new[rd_off].data_size = scratch_off - scratch_start;
              rd_off++;
            }
-           GNUNET_free (cname);
          }
+         GNUNET_free_non_null (cname);   
        }
        break;
       case GNUNET_DNSPARSER_TYPE_SOA:
@@ -1231,8 +1232,9 @@
              rd_new[rd_off].data_size = scratch_off - scratch_start;
              rd_off++;
            }
-           GNUNET_DNSPARSER_free_soa (soa);
          }
+         if (NULL != soa)
+           GNUNET_DNSPARSER_free_soa (soa);      
        }
        break;
       case GNUNET_DNSPARSER_TYPE_MX:
@@ -1266,8 +1268,9 @@
              rd_new[rd_off].data_size = scratch_off - scratch_start;
              rd_off++;
            }
-           GNUNET_DNSPARSER_free_mx (mx);
          }
+         if (NULL != mx)
+           GNUNET_DNSPARSER_free_mx (mx);        
        }       
        break;
       case GNUNET_DNSPARSER_TYPE_SRV:
@@ -1305,8 +1308,9 @@
              rd_new[rd_off].data_size = scratch_off - scratch_start;
              rd_off++;
            }
-           GNUNET_DNSPARSER_free_srv (srv);
          }
+         if (NULL != srv)
+           GNUNET_DNSPARSER_free_srv (srv);      
        }
        break;
       case GNUNET_NAMESTORE_TYPE_PKEY:

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2013-09-06 12:02:10 UTC (rev 
29067)
+++ gnunet/src/hostlist/hostlist-server.c       2013-09-06 12:05:24 UTC (rev 
29068)
@@ -634,6 +634,7 @@
                   ip);
       sa = NULL;
     }
+    GNUNET_free (ip);
   }
   else
     sa = NULL;

Modified: gnunet/src/identity/gnunet-identity.c
===================================================================
--- gnunet/src/identity/gnunet-identity.c       2013-09-06 12:02:10 UTC (rev 
29067)
+++ gnunet/src/identity/gnunet-identity.c       2013-09-06 12:05:24 UTC (rev 
29068)
@@ -264,10 +264,13 @@
   }
   if (! (list | monitor))
     return;
+  if (NULL == ego)
+    return;
   GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
   s = GNUNET_CRYPTO_ecc_public_key_to_string (&pk);
   if ( (monitor) || (NULL != identifier) )
     fprintf (stderr, "%s - %s\n", identifier, s);
+  GNUNET_free (s);
 }
 
 

Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h       2013-09-06 12:02:10 UTC 
(rev 29067)
+++ gnunet/src/include/gnunet_namestore_service.h       2013-09-06 12:05:24 UTC 
(rev 29068)
@@ -327,9 +327,9 @@
  * Process a record that was stored in the namestore.
  *
  * @param cls closure
- * @param zone private key of the zone
- * @param label label of the records
- * @param rd_count number of entries in @a rd array
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array, 0 if label was deleted
  * @param rd array of records with data to store
  */
 typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,

Modified: gnunet/src/namestore/gnunet-namestore-fcfsd.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore-fcfsd.c       2013-09-06 12:02:10 UTC 
(rev 29067)
+++ gnunet/src/namestore/gnunet-namestore-fcfsd.c       2013-09-06 12:05:24 UTC 
(rev 29068)
@@ -23,6 +23,8 @@
  * @author Christian Grothoff
  *
  * TODO:
+ * - need to track active zone info requests so we can cancel them
+ *   during shutdown, right?
  * - the code currently contains a 'race' between checking that the
  *   domain name is available and allocating it to the new public key
  *   (should this race be solved by namestore or by fcfsd?)
@@ -921,6 +923,8 @@
             void **ctx,
             const char *name)
 {
+  int options;
+
   id_op = NULL;
   if (NULL == ego)
   {
@@ -930,21 +934,24 @@
   }
   fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
 
-
-  httpd = MHD_start_daemon (
-#ifdef MHD_USE_DUAL_STACK
-                   MHD_USE_DUAL_STACK |
-#endif
-                   MHD_USE_DEBUG,
-                           (uint16_t) port,
-                           NULL, NULL, 
-                           &create_response, NULL, 
-                           MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128,
-                           MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 
1,
-                           MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
-                           MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 
1024), 
-                           MHD_OPTION_NOTIFY_COMPLETED, 
&request_completed_callback, NULL,
-                           MHD_OPTION_END);
+  options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG;
+  do
+    {
+      httpd = MHD_start_daemon (options,
+                               (uint16_t) port,
+                               NULL, NULL, 
+                               &create_response, NULL, 
+                               MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128,
+                               MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned 
int) 1,
+                               MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 
16,
+                               MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 
* 1024), 
+                               MHD_OPTION_NOTIFY_COMPLETED, 
&request_completed_callback, NULL,
+                               MHD_OPTION_END);
+      if (MHD_USE_DEBUG == options)
+       break;
+      options = MHD_USE_DEBUG;
+    }
+  while (NULL == httpd);
   if (NULL == httpd)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c     2013-09-06 12:02:10 UTC 
(rev 29067)
+++ gnunet/src/namestore/gnunet-service-namestore.c     2013-09-06 12:05:24 UTC 
(rev 29068)
@@ -752,7 +752,7 @@
              "Found result for zone-to-name lookup: `%s'\n", 
              name);
   res = GNUNET_YES;
-  name_len = strlen (name) + 1;
+  name_len = (NULL == name) ? 0 : strlen (name) + 1;
   rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
   msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len;
   if (msg_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)

Modified: gnunet/src/namestore/namestore_api_common.c
===================================================================
--- gnunet/src/namestore/namestore_api_common.c 2013-09-06 12:02:10 UTC (rev 
29067)
+++ gnunet/src/namestore/namestore_api_common.c 2013-09-06 12:05:24 UTC (rev 
29068)
@@ -450,8 +450,8 @@
   struct GNUNET_CRYPTO_AesInitializationVector iv;
   struct GNUNET_CRYPTO_AesSessionKey skey;
 
-  if (ntohl (block->purpose.size) <
-      sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) -
+  if (ntohl (block->purpose.size) <      
+      sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
       sizeof (struct GNUNET_TIME_AbsoluteNBO))
   {
     GNUNET_break_op (0);
@@ -979,6 +979,7 @@
                   &pkeys[slen / 2],
                   (int) (slen / 2),
                   pkeys);
+  GNUNET_free (pkeys);
   return ret;
 }
 

Modified: gnunet/src/regex/regex_api.c
===================================================================
--- gnunet/src/regex/regex_api.c        2013-09-06 12:02:10 UTC (rev 29067)
+++ gnunet/src/regex/regex_api.c        2013-09-06 12:05:24 UTC (rev 29068)
@@ -134,7 +134,10 @@
   a->cfg = cfg;
   a->client = GNUNET_CLIENT_connect ("regex", cfg);
   if (NULL == a->client)
+  {
+    GNUNET_free (a);
     return NULL;
+  }
   a->msg.header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_ANNOUNCE);
   a->msg.header.size = htons (slen + sizeof (struct AnnounceMessage));
   a->msg.compression = htons (compression);
@@ -299,11 +302,14 @@
   size_t slen;
 
   slen = strlen (string) + 1;
-  s = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Search));
+  s = GNUNET_new (struct GNUNET_REGEX_Search);
   s->cfg = cfg;
   s->client = GNUNET_CLIENT_connect ("regex", cfg);
   if (NULL == s->client)
+  {
+    GNUNET_free (s);
     return NULL;
+  }
   s->callback = callback;
   s->callback_cls = callback_cls;
   s->msg = GNUNET_malloc (sizeof (struct SearchMessage) + slen);




reply via email to

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