]> granicus.if.org Git - esp-idf/commitdiff
esp32: fix interrupt list insert issue
authorLiu Zhi Fu <liuzhifu@espressif.com>
Sun, 13 May 2018 03:46:09 +0000 (11:46 +0800)
committerLiu Zhi Fu <liuzhifu@espressif.com>
Mon, 14 May 2018 06:13:08 +0000 (14:13 +0800)
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.

components/esp32/intr_alloc.c

index ab0c3126fae65b1450cb3b1e5921fc49cae5a3c8..22d97ccc88f316868ed87abf2ed15e6b84fc7ad5 100644 (file)
@@ -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;