diff --git a/tools/lkl/lib/posix-host.c b/tools/lkl/lib/posix-host.c index 328859b3fba4bb..0d5f21136f0f5b 100644 --- a/tools/lkl/lib/posix-host.c +++ b/tools/lkl/lib/posix-host.c @@ -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); } diff --git a/tools/lkl/lib/virtio_net.c b/tools/lkl/lib/virtio_net.c index 349f11656daa67..912a7575f3eca8 100644 --- a/tools/lkl/lib/virtio_net.c +++ b/tools/lkl/lib/virtio_net.c @@ -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); }