vkd3d-shader/hlsl: Properly release string buffer on write_atan_or_atan2().

vkd3d_string_buffer_cleanup() doesn't do the same as
hlsl_release_string_buffer(). The former only frees the char array
inside the string buffer and not the string buffer itself.
This commit is contained in:
Francisco Casas 2024-04-04 18:22:41 -03:00 committed by Alexandre Julliard
parent 0e3377a1be
commit 5ab1ef1cad
Notes: Alexandre Julliard 2024-04-09 15:46:06 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/763

View File

@ -2836,20 +2836,20 @@ static bool write_atan_or_atan2(struct hlsl_ctx *ctx,
type->name, type->name, type->name); type->name, type->name, type->name);
if (ret < 0) if (ret < 0)
{ {
vkd3d_string_buffer_cleanup(buf); hlsl_release_string_buffer(ctx, buf);
return false; return false;
} }
ret = vkd3d_string_buffer_printf(buf, body_template, type->name); ret = vkd3d_string_buffer_printf(buf, body_template, type->name);
if (ret < 0) if (ret < 0)
{ {
vkd3d_string_buffer_cleanup(buf); hlsl_release_string_buffer(ctx, buf);
return false; return false;
} }
func = hlsl_compile_internal_function(ctx, func = hlsl_compile_internal_function(ctx,
atan2_mode ? atan2_name : atan_name, buf->buffer); atan2_mode ? atan2_name : atan_name, buf->buffer);
vkd3d_string_buffer_cleanup(buf); hlsl_release_string_buffer(ctx, buf);
if (!func) if (!func)
return false; return false;