Coverity 9657: Resource Leak
Accidentally leaked list item li in error path. The fix is to adjust this error path to ensure the allocated list item which has not yet been added to the list gets freed. To do this we simply add a new goto label slightly earlier to use the existing cleanup logic and minimize the number of unique return points.
This commit is contained in:
parent
02c7f16494
commit
63a93055fb
|
@ -380,7 +380,7 @@ splat_list_test7(struct file *file, void *arg)
|
||||||
"list node should inactive %p/%p\n",
|
"list node should inactive %p/%p\n",
|
||||||
li->li_node.prev, li->li_node.next);
|
li->li_node.prev, li->li_node.next);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out_li;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate node is active when linked in to a list */
|
/* Validate node is active when linked in to a list */
|
||||||
|
@ -403,7 +403,7 @@ splat_list_test7(struct file *file, void *arg)
|
||||||
li->li_node.prev, li->li_node.next);
|
li->li_node.prev, li->li_node.next);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
}
|
}
|
||||||
|
out_li:
|
||||||
kmem_free(li, sizeof(list_item_t));
|
kmem_free(li, sizeof(list_item_t));
|
||||||
out:
|
out:
|
||||||
/* Remove all items */
|
/* Remove all items */
|
||||||
|
|
Loading…
Reference in New Issue