Fixed a printf statment and 2 memory leaks

Some small fixes