diff options
author | Robert Gustafsson <robg@student.chalmers.se> | 2017-10-18 12:42:05 +0200 |
---|---|---|
committer | Robert Gustafsson <robg@student.chalmers.se> | 2017-10-18 12:42:05 +0200 |
commit | 0faa8f0dbe445f41c8f61a9b578d567338dd93c6 (patch) | |
tree | 2a962747006ca578d9176f15d40cc97b2007ee67 | |
parent | d1e8d44990eb9e1bb7280ccff07b0d396fdcc0ae (diff) | |
download | midbro-0faa8f0dbe445f41c8f61a9b578d567338dd93c6.tar.gz midbro-0faa8f0dbe445f41c8f61a9b578d567338dd93c6.tar.bz2 |
Fix memory leak causing not appended values to be allocatedshared-library
-rw-r--r-- | broccoli/src/fifoqueue.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/broccoli/src/fifoqueue.c b/broccoli/src/fifoqueue.c index 6a99740..f3d9272 100644 --- a/broccoli/src/fifoqueue.c +++ b/broccoli/src/fifoqueue.c @@ -47,6 +47,7 @@ add_to_queue(Fifo_q * q, Sensor_t * sensor) if(q == NULL){ printf("Error: Queue not initialized\n"); + free(sensor); //free if not appended return -1; } else if(is_full(q)){ @@ -55,6 +56,7 @@ add_to_queue(Fifo_q * q, Sensor_t * sensor) pop_from_queue(q); #endif q->droppedValues++; + free(sensor); //free if not appended return 0; } sem_wait(&q->lock); |