Fixed input memort leak