Potential Bug Fix : Checking NULL 55/99555/2
authorKunhoon Baik <knhoon.baik@samsung.com>
Wed, 23 Nov 2016 08:42:32 +0000 (17:42 +0900)
committerJung <pr.jung@samsung.com>
Thu, 24 Nov 2016 10:03:55 +0000 (02:03 -0800)
Change-Id: Id9c6bbdfe2d64933495a6d8a91080270543a916c

src/block/block.c

index d88bad3..fd399aa 100644 (file)
@@ -1664,8 +1664,15 @@ static void trigger_operation(struct block_device *bdev, dd_list *queue, struct
                block_send_dbus_reply(op->msg, ret);
 
                queue = bdev->op_queue;
-               queue = DD_LIST_NEXT(queue);
-               op = DD_LIST_NTH(queue, 0);
+               if(queue != NULL) {
+                       queue = DD_LIST_NEXT(queue);
+                       if(queue != NULL)
+                               op = DD_LIST_NTH(queue, 0);
+                       else
+                               op = NULL;
+               }else
+                       op = NULL;
+
                remove_operation(bdev);
 
                pthread_mutex_unlock(&(th_manager[thread_id].mutex));