Avoid memory leak of string