aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gustafsson <robg@student.chalmers.se>2017-10-18 12:42:05 +0200
committerAndreas Lindhé <andreas@lindhe.io>2017-10-18 20:34:22 +0200
commit51f92be11ee8989424281af0b1a2bc1f66e04e54 (patch)
tree1cd5e56164d1db63f0bc5c146212a769b665769d
parent7ddb241b20b219dc4069d455d0a69b9f5e80d761 (diff)
downloadmidbro-51f92be11ee8989424281af0b1a2bc1f66e04e54.tar.gz
midbro-51f92be11ee8989424281af0b1a2bc1f66e04e54.tar.bz2
Attempt to fix memory leak
Fix memory leak causing not appended values to be allocated
-rw-r--r--broccoli/src/fifoqueue.c2
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);