Browse Source

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.
tags/v1.9.21
Florian Walpen Filipe Coelho <falktx@falktx.com> 3 years ago
parent
commit
84a21a8cb9
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      example-clients/midi_latency_test.c

+ 1
- 1
example-clients/midi_latency_test.c View File

@@ -163,7 +163,7 @@ create_semaphore(int id)
semaphore = NULL; semaphore = NULL;
} }
#else #else
semaphore = malloc(sizeof(semaphore_t));
semaphore = malloc(sizeof(sem_t));
if (semaphore != NULL) { if (semaphore != NULL) {
if (sem_init(semaphore, 0, 0)) { if (sem_init(semaphore, 0, 0)) {
free(semaphore); free(semaphore);


Loading…
Cancel
Save