fix #3275 with solution from https://gnunet.org/bugs/view.php?id=3275#c8029
[oweals/gnunet.git] / src / namestore / test_namestore_api_lookup_shadow.c
index e77e9f2dfcac89d25f5ccc92a86cccaedb241e37..dde224e1ef563ff8807532027a27fd98f5e105a4 100644 (file)
@@ -73,11 +73,6 @@ cleanup ()
     GNUNET_free (privkey);
     privkey = NULL;
   }
-  if (NULL != directory)
-  {
-      GNUNET_DISK_directory_remove (directory);
-      GNUNET_free (directory);
-  }
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -233,6 +228,7 @@ run (void *cls,
 
   directory = NULL;
   GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory);
+  GNUNET_DISK_directory_remove (directory);
 
   endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                &endbadly, NULL);
@@ -277,7 +273,14 @@ main (int argc, char *argv[])
                                "test_namestore_api.conf",
                                &run,
                                NULL))
-    return 1;
+  {
+    res = 1;
+  }
+  if (NULL != directory)
+  {
+      GNUNET_DISK_directory_remove (directory);
+      GNUNET_free (directory);
+  }
   return res;
 }