fix for segfault
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 14 Jun 2012 08:51:48 +0000 (08:51 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 14 Jun 2012 08:51:48 +0000 (08:51 +0000)
src/util/test_common_logging_runtime_loglevels.c

index 5ad9d986035455aea94056df60a908e0f90cf568..df152ba6a618d9f456d88d815f33e76f15f04a9a 100644 (file)
@@ -50,13 +50,16 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending phase %d, ok is %d\n", phase,
               ok);
-  if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
+  if (NULL != proc)
   {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+    if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+    }
+    GNUNET_OS_process_wait (proc);
+    GNUNET_OS_process_destroy (proc);
+    proc = NULL;
   }
-  GNUNET_OS_process_wait (proc);
-  GNUNET_OS_process_destroy (proc);
-  proc = NULL;
   GNUNET_DISK_pipe_close (pipe_stdout);
   if (ok == 1)
   {