CPP : Properly free old image before loading another one