summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);