stuff
authorChristian Grothoff <christian@grothoff.org>
Fri, 7 May 2010 23:42:28 +0000 (23:42 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 7 May 2010 23:42:28 +0000 (23:42 +0000)
src/datastore/Makefile.am
src/datastore/gnunet-service-datastore.c
src/fs/fs.c
src/fs/fs_publish.c
src/fs/fs_search.c
src/fs/test_fs_publish_persistence.c
src/fs/test_fs_unindex.c
src/fs/test_fs_unindex_persistence.c
src/statistics/statistics_api.c
src/util/connection.c

index e572eafd0b4f10141ff0e23fd80bf07a062ed234..a3882d6763757f3cca92aa0cb72925781b5840cb 100644 (file)
@@ -32,7 +32,6 @@ bin_PROGRAMS = \
 gnunet_service_datastore_SOURCES = \
  gnunet-service-datastore.c plugin_datastore.h
 gnunet_service_datastore_LDADD = \
-  $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL)
index 6d0f29671211c240121b9cf0763353f0f37a77a0..fc0587cf7a08582682479a20aeb9772ca12772bf 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
 #include "gnunet_protocols.h"
 #include "gnunet_statistics_service.h"
 #include "plugin_datastore.h"
@@ -1304,7 +1303,6 @@ unload_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       GNUNET_CONTAINER_bloomfilter_free (filter);
       filter = NULL;
     }
-  GNUNET_ARM_stop_services (cfg, tc->sched, "statistics", NULL);
   if (stats != NULL)
     {
       GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
@@ -1453,13 +1451,11 @@ run (void *cls,
        }
       return;
     }
-  GNUNET_ARM_start_services (cfg, sched, "statistics", NULL);
   plugin = load_plugin ();
   if (NULL == plugin)
     {
       GNUNET_CONTAINER_bloomfilter_free (filter);
       filter = NULL;
-      GNUNET_ARM_stop_services (cfg, sched, "statistics", NULL);
       if (stats != NULL)
        {
          GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
index d2ac711f2ba949c41bb69d1fd797e9ddbffb57dd..34850f14cb38fae22802e5b330cb780a7c0e25b6 100644 (file)
@@ -880,6 +880,7 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
       ret->data.file.reader_cls = GNUNET_FS_make_file_reader_context_ (ret->filename);
       break;
     case 4: /* directory */
+      ret->is_directory = GNUNET_YES;
       if ( (GNUNET_OK !=
            GNUNET_BIO_read_int32 (rh, &dsize)) ||
           (NULL == (ret->data.dir.dir_data = GNUNET_malloc_large (dsize))) ||
@@ -892,7 +893,6 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
          goto cleanup;
        }
       ret->data.dir.dir_size = (uint32_t) dsize;
-      ret->is_directory = GNUNET_YES;
       if (filename != NULL)
        {
          ret->data.dir.entries = deserialize_file_information (h, filename);
@@ -1451,6 +1451,8 @@ deserialize_publish_file (void *cls,
            pc->fi_pos = pc->fi;
        }
     }
+  GNUNET_free (fi_root);
+  fi_root = NULL;
   /* generate RESUME event(s) */
   GNUNET_FS_file_information_inspect (pc->fi,
                                      &fip_signal_resume,
index 6d3f4679db9058d3b2c1eb93df68b9565b6f87c2..be2994176998172f48fd98c8eb3c19b2915db487 100644 (file)
@@ -149,6 +149,7 @@ ds_put_cont (void *cls,
       /* we were aborted in the meantime,
         finish shutdown! */
       publish_cleanup (pcc->sc);
+      GNUNET_free (pcc);
       return;
     }
   GNUNET_assert (GNUNET_YES == pcc->sc->in_network_wait);
@@ -1587,6 +1588,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
   memcpy (dest, update, nidlen);
   dest += nidlen;
   memcpy (dest, uris, slen);
+  GNUNET_free (uris);
   dest += slen;
   mdsize = GNUNET_CONTAINER_meta_data_serialize (mmeta,
                                                 &dest,
@@ -1596,7 +1598,6 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
   if (mdsize == -1)
     {
       GNUNET_break (0);
-      GNUNET_free (uris);
       GNUNET_free (sb);
       cont (cont_cls,
            NULL,
index 171eebf4bc21ee3079fdff84b160381f9853d345..af405bfc0a2a5744f337c6191bc6179baabcfa41 100644 (file)
@@ -529,6 +529,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc,
                       sc->options,
                       NULL,
                       sr);
+  GNUNET_free (uu.data.sks.identifier);
 }
 
 
@@ -1308,6 +1309,7 @@ GNUNET_FS_search_signal_suspend_ (void *cls)
   GNUNET_free_non_null (sc->requests);
   GNUNET_free_non_null (sc->emsg);
   GNUNET_FS_uri_destroy (sc->uri);
+  GNUNET_free_non_null (sc->serialization);
   GNUNET_free (sc);
 }
 
@@ -1474,6 +1476,7 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc)
                                  ? GNUNET_FS_SYNC_PATH_CHILD_SEARCH 
                                  : GNUNET_FS_SYNC_PATH_MASTER_SEARCH,
                                  sc->serialization);
+      GNUNET_free (sc->serialization);
     }
   pi.status = GNUNET_FS_STATUS_SEARCH_STOPPED;
   sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc);
index 3e59d92be1984c4ae3bc8872004137c8180546c7..d39a630db544cb0bfe40262af5675739737112a8 100644 (file)
@@ -390,10 +390,16 @@ main (int argc, char *argv[])
                      "nohelp", options, &run, NULL);
   stop_arm (&p1);
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-publish/");
-  GNUNET_DISK_directory_remove (fn1);
-  GNUNET_free_non_null (fn1);
-  GNUNET_DISK_directory_remove (fn2);
-  GNUNET_free_non_null (fn2);
+  if (fn1 != NULL)
+    {
+      GNUNET_DISK_directory_remove (fn1);
+      GNUNET_free (fn1);
+    }
+  if (fn2 != NULL)
+    {
+      GNUNET_DISK_directory_remove (fn2);
+      GNUNET_free (fn2);
+    }
   return err;
 }
 
index 861685d3223b16fc19555a9c2ba2ac75fcd6f99a..81beb33824c5684102ab15a78e0e177f3c5e2720 100644 (file)
@@ -310,8 +310,11 @@ main (int argc, char *argv[])
                      "nohelp", options, &run, NULL);
   stop_arm (&p1);
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-unindex/");
-  GNUNET_DISK_directory_remove (fn);
-  GNUNET_free_non_null (fn);
+  if (NULL != fn)
+    {
+      GNUNET_DISK_directory_remove (fn);
+      GNUNET_free (fn);
+    }
   return 0;
 }
 
index 2185be21d02952d18b543502a343c38eddac0c79..9bf617ba24cbbac88df0e1c48011b7249c4130cc 100644 (file)
@@ -375,8 +375,11 @@ main (int argc, char *argv[])
                      "nohelp", options, &run, NULL);
   stop_arm (&p1);
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-unindex/");
-  GNUNET_DISK_directory_remove (fn);
-  GNUNET_free_non_null (fn);
+  if (NULL != fn)
+    {
+      GNUNET_DISK_directory_remove (fn);
+      GNUNET_free (fn);
+    }
   return 0;
 }
 
index 48b038cfe51c35f46cf5e7e0b6f93c75aaecd48a..523b9eb5f41ce803231db6d06c5887aea4df9f55 100644 (file)
@@ -556,6 +556,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h,
                h->action_tail = NULL;
            }
        }
+      h->do_destroy = GNUNET_YES;
       if ( (h->current != NULL) &&
           (h->th == NULL) )
        {                                       
@@ -567,8 +568,8 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h,
                                                       &transmit_action, h);
          GNUNET_assert (NULL != h->th);
        }
-      h->do_destroy = GNUNET_YES;
-      return;
+      if (h->th != NULL)
+       return;
     }
   if (NULL != h->th)
     {
index 4a54aed1d8e4855f6ab2f39f61c33d50d2e031fc..a877e06c2dcde6f6acaaf3e60d15f82babd9a524 100644 (file)
@@ -539,9 +539,14 @@ destroy_continuation (void *cls,
       notify (sock->nth.notify_ready_cls, 0, NULL);
     }
 
-  if ((sock->sock != NULL) && (sock->persist != GNUNET_YES))
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock->sock));
-
+  if (sock->sock != NULL) 
+    {
+      if (sock->persist != GNUNET_YES)
+       GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock->sock));
+      else
+       GNUNET_free (sock->sock); /* at least no memory leak (we deliberately
+                                    leak the socket in this special case) ... */
+    }
   GNUNET_free_non_null (sock->addr);
   GNUNET_free_non_null (sock->hostname);
 #if DEBUG_CONNECTION