From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Don't forget to unlock before erroring out. Coverity-id: 1454843 Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- libfrog/workqueue.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libfrog/workqueue.c b/libfrog/workqueue.c index 07f11a7b..a93bba3d 100644 --- a/libfrog/workqueue.c +++ b/libfrog/workqueue.c @@ -142,8 +142,11 @@ workqueue_add( if (wq->next_item == NULL) { assert(wq->item_count == 0); ret = pthread_cond_signal(&wq->wakeup); - if (ret) - goto out_item; + if (ret) { + pthread_mutex_unlock(&wq->lock); + free(wi); + return ret; + } wq->next_item = wi; } else { wq->last_item->next = wi; @@ -153,9 +156,6 @@ workqueue_add( pthread_mutex_unlock(&wq->lock); return 0; -out_item: - free(wi); - return ret; } /*