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 3fd4079..4e7508a 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);
        }
 }
 
        }
 }