pndnotifyd: fix some crashes master
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 8 May 2016 20:50:01 +0000 (23:50 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 8 May 2016 20:50:01 +0000 (23:50 +0300)
apps/pndnotifyd.c

index 5f7f231..aa79185 100644 (file)
@@ -436,8 +436,12 @@ int main ( int argc, char *argv[] ) {
 
   /* shutdown
    */
 
   /* shutdown
    */
-  pnd_notify_shutdown ( nh );
-  pnd_dbusnotify_shutdown ( dbh );
+  if ( nh ) {
+    pnd_notify_shutdown ( nh );
+  }
+  if ( dbh ) {
+    pnd_dbusnotify_shutdown ( dbh );
+  }
 
   return ( 0 );
 }
 
   return ( 0 );
 }
@@ -735,10 +739,12 @@ void sigint_handler ( int n ) {
 
   if ( dbh ) {
     pnd_dbusnotify_shutdown ( dbh );
 
   if ( dbh ) {
     pnd_dbusnotify_shutdown ( dbh );
+    dbh = NULL;
   }
 
   if ( nh ) {
     pnd_notify_shutdown ( nh );
   }
 
   if ( nh ) {
     pnd_notify_shutdown ( nh );
+    nh = NULL;
   }
 
   return;
   }
 
   return;