fix: should check the mem of buf_t structure member before deallocation.