Freeing the momory in cmdArray each time before prompt().