Remember to free the name buffer as well