Fixed a ton of leaks and unititialised reads :)

when copying strings, don't forget the +1
char* dest = new char[strlen(src) + 1];
strcpy(dest, src);