From 3f1b90d638e6c8bc6d929cef3626371b9e87afe1 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 25 Mar 2021 18:16:54 -0700 Subject: [PATCH] microsoft/compiler: Move blob_init earlier to prevent crash on failure Reviewed-by: Bill Kristiansen Acked-by: Michael Tang Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index d248f8f9651..d120d5fcdd9 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -4232,6 +4232,7 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts, assert(opts); bool retval = true; debug_dxil = (int)debug_get_option_debug_dxil(); + blob_init(blob); struct ntd_context *ctx = calloc(1, sizeof(*ctx)); if (!ctx) @@ -4323,7 +4324,6 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts, goto out; } - blob_init(blob); if (!dxil_container_write(&container, blob)) { debug_printf("D3D12: dxil_container_write failed\n"); retval = false;