Fixes memory leak

Since the function is using va_copy(), it must also call va_end()
before it exists in order to free va_list’s memory.
Clean up