alcove_encode_buf_to_list: fix memory leak