properly free pointers to char