You should be free()ing what you malloc()