Fixed memory leak in the event of a failure of BUF_MEM_grow