commit 072e9297193249dc48a6fd668f4c6e5546761c66
parent 654ff4eaff7e0cf7b7b95ea04b021396c65bc849
Author: Jacob R. Edwards <n/a>
Date: Sun, 20 Feb 2022 13:16:04 -0800
Fix NULL dereference bug
With only one item on the queue item->next and item->prev were left
as NULL, but if the queue isn't NULL the queue should be a circular
linked list. This caused run() to dereference NULL when the
player->state was COMPLETE.
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/aps/queue.c b/aps/queue.c
@@ -50,6 +50,7 @@ queue_add(struct aps *aps, char *s)
return 1;
if (aps->queue == NULL) {
+ item->prev = item->next = item;
queue_set(aps, item); /* ignore player errors */
} else if (item_insert(aps->queue, item)) {
item_free(item);