free the buffer as well