Fix memory leak in Smart Search CLI (routing)