terminal: use xstrdup instead to handle OOM

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>