buffer: fix a memory leak in get_context_classes_at_iter()