as free allow to pass a NULL pointer

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagn...@jcrosoft.com>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to