Seems users have to take care of these pointers, should they be freed somewhere? Have you checked this example with valgrind?