gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37383 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r37383 - gnunet/src/util
Date: Mon, 27 Jun 2016 10:17:55 +0200

Author: grothoff
Date: 2016-06-27 10:17:55 +0200 (Mon, 27 Jun 2016)
New Revision: 37383

Modified:
   gnunet/src/util/os_priority.c
Log:
fix potential NPE on shutdown

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2016-06-27 07:48:14 UTC (rev 37382)
+++ gnunet/src/util/os_priority.c       2016-06-27 08:17:55 UTC (rev 37383)
@@ -70,7 +70,12 @@
  */
 static struct GNUNET_SCHEDULER_Task *pch;
 
+/**
+ * Handle for the #shutdown_pch() Task.
+ */
+static struct GNUNET_SCHEDULER_Task *spch;
 
+
 /**
  * This handler is called on shutdown to remove the #pch.
  *
@@ -80,7 +85,7 @@
 shutdown_pch (void *cls)
 {
   struct GNUNET_DISK_FileHandle *control_pipe = cls;
-    
+
   GNUNET_SCHEDULER_cancel (pch);
   pch = NULL;
   GNUNET_DISK_file_close (control_pipe);
@@ -114,6 +119,8 @@
         "Closing control pipe\n");
     GNUNET_DISK_file_close (control_pipe);
     control_pipe = NULL;
+    GNUNET_SCHEDULER_cancel (spch);
+    spch = NULL;
     return;
   }
   pipe_fd = getenv (GNUNET_OS_CONTROL_PIPE);
@@ -205,8 +212,8 @@
                                        control_pipe,
                                        &parent_control_handler,
                                        control_pipe);
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_pch,
-                                control_pipe);
+  spch = GNUNET_SCHEDULER_add_shutdown (&shutdown_pch,
+                                        control_pipe);
   putenv (GNUNET_OS_CONTROL_PIPE "=");
 }
 
@@ -1858,7 +1865,7 @@
     cmd->off -= (end + 1 - cmd->buf);
     end = memchr (cmd->buf, '\n', cmd->off);
   }
-  cmd->rtask 
+  cmd->rtask
     = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining
                                       (cmd->timeout),
                                      cmd->r,




reply via email to

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