fix memory leak

by not defining a variable of type std::string in a function which
might call exit();