Skip to content
Snippets Groups Projects
Commit 139d4f90 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

NULL check needs to be outside the lock. :D

Also, no, Coverity still doesn't know from recursive mutexes.
parent ffd0cdff
No related branches found
No related tags found
No related merge requests found
Pipeline #7752 passed
...@@ -150,6 +150,7 @@ long listDettach(link_list_t* list) ...@@ -150,6 +150,7 @@ long listDettach(link_list_t* list)
if((refs=--list->refs)==0) { if((refs=--list->refs)==0) {
listUnlock(list); listUnlock(list);
// coverity[sleep:SUPPRESS]
listFree(list); listFree(list);
} }
else else
...@@ -502,8 +503,11 @@ bool listNodeIsLocked(const list_node_t* node) ...@@ -502,8 +503,11 @@ bool listNodeIsLocked(const list_node_t* node)
bool listLockNode(list_node_t* node) bool listLockNode(list_node_t* node)
{ {
if (node == NULL)
return false;
listLock(node->list); listLock(node->list);
if(node==NULL || (node->flags&LINK_LIST_LOCKED)) { if(node->flags&LINK_LIST_LOCKED) {
listUnlock(node->list); listUnlock(node->list);
return(false); return(false);
} }
...@@ -769,6 +773,7 @@ void* listRemoveTaggedNode(link_list_t* list, list_node_tag_t tag, bool free_dat ...@@ -769,6 +773,7 @@ void* listRemoveTaggedNode(link_list_t* list, list_node_tag_t tag, bool free_dat
listLock(list); listLock(list);
// coverity[double_lock:SUPPRESS]
if((node=listFindTaggedNode(list, tag)) != NULL) if((node=listFindTaggedNode(list, tag)) != NULL)
data = list_remove_node(list, node, free_data); data = list_remove_node(list, node, free_data);
...@@ -794,10 +799,12 @@ long listRemoveNodes(link_list_t* list, list_node_t* node, long max, bool free_d ...@@ -794,10 +799,12 @@ long listRemoveNodes(link_list_t* list, list_node_t* node, long max, bool free_d
for(count=0; node!=NULL && count<max; node=next_node, count++) { for(count=0; node!=NULL && count<max; node=next_node, count++) {
next_node = node->next; next_node = node->next;
// coverity[double_lock:SUPPRESS]
if(listRemoveNode(list, node, free_data)==NULL) if(listRemoveNode(list, node, free_data)==NULL)
break; break;
} }
// coverity[double_unlock:SUPPRESS]
listUnlock(list); listUnlock(list);
return(count); return(count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment