From: Liu Zhi Fu Date: Sun, 13 May 2018 03:46:09 +0000 (+0800) Subject: esp32: fix interrupt list insert issue X-Git-Tag: v3.1-beta1~138^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c81e4be600b9ca8abe1af3beba93c15f561960a;p=esp-idf esp32: fix interrupt list insert issue If the allocated interrupt list is not empty and the new item will be inserted as the header of the list, insert_vector_desc() causes crash because pre is null. This commit fix this issue. --- diff --git a/components/esp32/intr_alloc.c b/components/esp32/intr_alloc.c index ab0c3126fa..22d97ccc88 100644 --- a/components/esp32/intr_alloc.c +++ b/components/esp32/intr_alloc.c @@ -194,10 +194,10 @@ static void insert_vector_desc(vector_desc_t *to_insert) prev=vd; vd=vd->next; } - if (vd==NULL && prev==NULL) { + if ((vector_desc_head==NULL) || (prev==NULL)) { //First item + to_insert->next = vd; vector_desc_head=to_insert; - vector_desc_head->next=NULL; } else { prev->next=to_insert; to_insert->next=vd;