The given implementation is correct.
In call-by-value-result parameter passing mechanism, formal parameter gets its initial value from the actual parameter being passed. During execution of the function, there is no effect on the actual argument but once the function is returned, the final value of the parameter is copied back to the actual parameter. And this is exactly what the given implementation does.
This is different from call-by-reference in the sense that there whatever modification happens to the parameter in a function, it must reflect in the actual argument too. These two can produce different outputs if a global variable is being used as a parameter.