From 64e0f2d80ae454255c6e5d6aeb96c2d78058cc65 Mon Sep 17 00:00:00 2001 From: Victor Fernandes Date: Mon, 13 Feb 2017 16:58:51 -0500 Subject: [PATCH] b_free() fix crash on NULL --- buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buffer.c b/buffer.c index a0a848e..ed37a2d 100644 --- a/buffer.c +++ b/buffer.c @@ -548,6 +548,8 @@ Buffer* b_pack(Buffer* const pBD) { * Return value: N/A */ void b_free(Buffer* const pBD) { - free(pBD->cb_head); - free(pBD); + if (pBD){ + free(pBD->cb_head); + free(pBD); + } }