An object created in a function parameter is valid until the function returns - it's destructed on the function return.  What you need to be careful of is storing a pointer or reference in that function.

(After all, CURL::Get() as was done before creates a string object as well).