Fixed issue where I wasn't allocating enough memory in malloc