R: fixed some memory leaks in graph.bfs().