From 12c760f05c2749288a2b924977326f68c22a3ff1 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 25 Jan 2018 15:47:12 +0000 Subject: [PATCH] [ft-lib/bcache] add a check to list_pop() --- ft-lib/bcache.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ft-lib/bcache.c b/ft-lib/bcache.c index f9f474a..fd6a54c 100644 --- a/ft-lib/bcache.c +++ b/ft-lib/bcache.c @@ -51,6 +51,9 @@ static inline struct list_head *list_pop(struct list_head *head) { struct list_head *l; + if (head->next == head) + raise("list is empty\n"); + l = head->next; list_del(l); return l;