flush pluto's event queue
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 16 Apr 2009 09:44:08 +0000 (09:44 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 16 Apr 2009 09:44:08 +0000 (09:44 -0000)
src/pluto/plutomain.c
src/pluto/timer.c
src/pluto/timer.h

index e497aa0..18ff7c9 100644 (file)
@@ -707,9 +707,10 @@ exit_pluto(int status)
     stop_adns();
     free_md_pool();
     free_crypto();
-    free_id();
+    free_id();                 /* free myids */
+    free_events();             /* free remaining events */
     delete_lock();
-       library_deinit();
+    library_deinit();
     close_log();
     exit(status);
 }
index 472fd5c..860ed00 100644 (file)
@@ -529,4 +529,22 @@ delete_dpd_event(struct state *st)
     }
 }
 
+/*
+ * Free remaining events
+ */
+void
+free_events(void)
+{
+    struct event *ev_tmp, *ev;
+
+    ev = evlist;
+    evlist = NULL;
+
+    while (ev)
+    {
+       ev_tmp = ev;
+       ev = ev->ev_next;
+       free(ev_tmp);
+    }
+}
 
index f8337c8..3009591 100644 (file)
@@ -32,3 +32,4 @@ extern long next_event(void);
 extern void delete_event(struct state *st);
 extern void delete_dpd_event(struct state *st);
 extern void daily_log_event(void);
+extern void free_events(void);