It looks to me in the C version, he only frees the first listener. The C++ version also provides the listeners as a set. The C version doesn't mind if you add the same listener multiple times, so to be apples to apples you'd use a vector, but the code wouldn't change otherwise, so no problem there.