vkd3d-dxbc: Close output files after writing them.

This commit is contained in:
Henri Verbeet 2024-04-03 17:56:52 +02:00 committed by Alexandre Julliard
parent 8653ce17cf
commit 2712a79c55
Notes: Alexandre Julliard 2024-04-04 22:42:25 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/755

View File

@ -514,6 +514,7 @@ int main(int argc, char **argv)
FILE *input, *output; FILE *input, *output;
char *messages; char *messages;
uint32_t flags; uint32_t flags;
bool success;
int fail = 1; int fail = 1;
size_t i; size_t i;
int ret; int ret;
@ -583,18 +584,15 @@ int main(int argc, char **argv)
goto done; goto done;
} }
if (!write_output(output, &serialized)) if (!(success = write_output(output, &serialized)))
{
fprintf(stderr, "Failed to write output blob.\n"); fprintf(stderr, "Failed to write output blob.\n");
vkd3d_shader_free_shader_code(&serialized);
goto done;
}
if (close_output)
fclose(output);
vkd3d_shader_free_shader_code(&serialized); vkd3d_shader_free_shader_code(&serialized);
if (!success)
goto done;
break; break;
default:
vkd3d_unreachable();
} }
} }
@ -605,7 +603,5 @@ done:
free(options.actions); free(options.actions);
if (close_input) if (close_input)
fclose(input); fclose(input);
if (close_output)
fclose(output);
return fail; return fail;
} }