Replaced malloc & free by new & delete