Finish properly the sbuf and plug a leak