Skip to content

Commit

Permalink
Merge pull request torvalds#154 from liuyuan10/fixqueuelock
Browse files Browse the repository at this point in the history
lkl: properly free mutex and semaphore.
  • Loading branch information
Octavian Purdila committed May 6, 2016
2 parents 982984f + 26d9f30 commit 6b9bafd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tools/lkl/lib/posix-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ static struct lkl_sem_t *sem_alloc(int count)

static void sem_free(struct lkl_sem_t *sem)
{
#ifdef _POSIX_SEMAPHORES
WARN_UNLESS(sem_destroy(&sem->sem));
#else
WARN_PTHREAD(pthread_cond_destroy(&sem->cond));
WARN_PTHREAD(pthread_mutex_destroy(&sem->lock));
#endif /* _POSIX_SEMAPHORES */
free(sem);
}

Expand Down
2 changes: 1 addition & 1 deletion tools/lkl/lib/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static void free_queue_locks(struct lkl_mutex_t **queues, int num_queues)
return;

for (i = 0; i < num_queues; i++)
lkl_host_ops.mem_free(queues[i]);
lkl_host_ops.mutex_free(queues[i]);

lkl_host_ops.mem_free(queues);
}
Expand Down

0 comments on commit 6b9bafd

Please sign in to comment.