Fix a NULL pointer dereference during shutdown
authorDan Fandrich <dan@coneharvesters.com>
Mon, 4 Feb 2013 22:59:41 +0000 (23:59 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 5 Feb 2013 06:59:40 +0000 (07:59 +0100)
Signed-off-by: Florian Forster <octo@collectd.org>
src/plugin.c

index 7037234..942f8bf 100644 (file)
@@ -810,10 +810,12 @@ static void stop_write_threads (void) /* {{{ */
 
        pthread_mutex_lock (&write_lock);
        i = 0;
-       for (q = write_queue_head; q != NULL; q = q->next)
+       for (q = write_queue_head; q != NULL; )
        {
+               write_queue_t *q1 = q;
                plugin_value_list_free (q->vl);
-               sfree (q);
+               q = q->next;
+               sfree (q1);
                i++;
        }
        write_queue_head = NULL;