]> Pileus Git - wmpus/blobdiff - util.c
Support graceful shutdown
[wmpus] / util.c
diff --git a/util.c b/util.c
index cb196bffb6e6bb78674e78f76f03aa5b72d023df..aeb766eaa01f32d65234e84261b97d63d503efe3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -55,12 +55,14 @@ list_t *list_append(list_t *head, void *data)
        return last ? head : node;
 }
 
-list_t *list_remove(list_t *head, list_t *node)
+list_t *list_remove(list_t *head, list_t *node, int freedata)
 {
        list_t *next = node->next;
        list_t *prev = node->prev;
        if (next) next->prev = prev;
        if (prev) prev->next = next;
+       if (freedata)
+               free(node->data);
        free(node);
        return head == node ? next : head;
 }