b_free() fix crash on NULL

This commit is contained in:
Victor Fernandes 2017-02-13 16:58:51 -05:00
parent c80fb62142
commit 64e0f2d80a
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}
}