Veramente esegue questa linea

while(strcmp(il->codice,cod)!=0 && il!=NULL)

che crea il crash