From 84a21a8cb9afe8008efdc0e76f60df52d26fe44c Mon Sep 17 00:00:00 2001 From: Florian Walpen Date: Sat, 22 Jan 2022 22:32:34 +0100 Subject: [PATCH] Bad semaphore allocation in midi_latency_test. The code did a pointer-sized heap allocation instead of the actual size of a semaphore struct sem_t. This could result in heap memory corruption when handling the semaphore. Found by llvm scan-build. --- example-clients/midi_latency_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-clients/midi_latency_test.c b/example-clients/midi_latency_test.c index 1a6988c0..b70d7243 100644 --- a/example-clients/midi_latency_test.c +++ b/example-clients/midi_latency_test.c @@ -163,7 +163,7 @@ create_semaphore(int id) semaphore = NULL; } #else - semaphore = malloc(sizeof(semaphore_t)); + semaphore = malloc(sizeof(sem_t)); if (semaphore != NULL) { if (sem_init(semaphore, 0, 0)) { free(semaphore);