Skip to content

Commit 6b9bafd

Browse files
author
Octavian Purdila
committed
Merge pull request torvalds#154 from liuyuan10/fixqueuelock
lkl: properly free mutex and semaphore.
2 parents 982984f + 26d9f30 commit 6b9bafd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tools/lkl/lib/posix-host.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ static struct lkl_sem_t *sem_alloc(int count)
9090

9191
static void sem_free(struct lkl_sem_t *sem)
9292
{
93+
#ifdef _POSIX_SEMAPHORES
94+
WARN_UNLESS(sem_destroy(&sem->sem));
95+
#else
96+
WARN_PTHREAD(pthread_cond_destroy(&sem->cond));
97+
WARN_PTHREAD(pthread_mutex_destroy(&sem->lock));
98+
#endif /* _POSIX_SEMAPHORES */
9399
free(sem);
94100
}
95101

tools/lkl/lib/virtio_net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void free_queue_locks(struct lkl_mutex_t **queues, int num_queues)
150150
return;
151151

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

155155
lkl_host_ops.mem_free(queues);
156156
}

0 commit comments

Comments
 (0)