vkd3d-compiler: Clean up the shader code in all failure paths (Valgrind).

This commit is contained in:
Giovanni Mascellani 2024-04-02 09:48:46 +02:00 committed by Alexandre Julliard
parent 2a101cf697
commit 9047dad4bc
Notes: Alexandre Julliard 2024-04-03 00:22:07 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/751

View File

@ -718,7 +718,7 @@ int main(int argc, char **argv)
struct vkd3d_shader_spirv_target_info spirv_target_info = {0};
struct vkd3d_shader_hlsl_source_info hlsl_source_info = {0};
bool close_input = false, close_output = false;
struct vkd3d_shader_compile_info info;
struct vkd3d_shader_compile_info info = {0};
struct vkd3d_shader_code output_code;
struct options options;
FILE *input, *output;
@ -876,7 +876,6 @@ int main(int argc, char **argv)
if (messages)
fputs(messages, stderr);
vkd3d_shader_free_messages(messages);
vkd3d_shader_free_shader_code(&info.source);
if (ret < 0)
{
fprintf(stderr, "Failed to compile shader, ret %d.\n", ret);
@ -893,6 +892,7 @@ int main(int argc, char **argv)
fail = 0;
vkd3d_shader_free_shader_code(&output_code);
done:
vkd3d_shader_free_shader_code(&info.source);
free(options.compile_options);
if (close_output)
fclose(output);