[PATCH 1/9] kfifo: allow to pass a null point on kfifo_free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



as free allow to pass a NULL pointer

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>
---
 lib/kfifo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/kfifo.c b/lib/kfifo.c
index 307dae1..601202d 100644
--- a/lib/kfifo.c
+++ b/lib/kfifo.c
@@ -70,6 +70,8 @@ struct kfifo *kfifo_alloc(unsigned int size)
  */
 void kfifo_free(struct kfifo *fifo)
 {
+	if (!fifo)
+		return;
 	free(fifo->buffer);
 	free(fifo);
 }
-- 
2.1.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux