managesieve: prevent session list corruption
authorCharles Lehner <cel@celehner.com>
Sun, 19 Jul 2015 01:58:03 +0000 (21:58 -0400)
committerCharles Lehner <cel@celehner.com>
Sun, 19 Jul 2015 01:58:03 +0000 (21:58 -0400)
This fixes a crash on plugin unload with a connected session

src/plugins/managesieve/managesieve.c

index 3fd40797109e45ad55c135ffc71ac42424c40fbf..4e7508a764d14a5df580ee23fb4c8f815c97b4d4 100644 (file)
@@ -46,8 +46,9 @@ static void command_cb(SieveCommand *cmd, gpointer result);
 void sieve_sessions_close()
 {
        if (sessions) {
 void sieve_sessions_close()
 {
        if (sessions) {
-               g_slist_free_full(sessions, (GDestroyNotify)session_destroy);
+               GSList *list = sessions;
                sessions = NULL;
                sessions = NULL;
+               g_slist_free_full(list, (GDestroyNotify)session_destroy);
        }
 }
 
        }
 }