Fix mem-leak condition