What I use does work certainly, but I was not sure if all of the memory was freed correctly. As the free() function takes a void* parameter, my guess is that the pointer type does not really matter ?