Fix mem leak in enum