fix memory leak in itemdef

cleanup useless code