Mesa (master): microsoft/compiler: Move blob_init earlier to prevent crash on failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 2 17:24:52 UTC 2021


Module: Mesa
Branch: master
Commit: 3f1b90d638e6c8bc6d929cef3626371b9e87afe1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f1b90d638e6c8bc6d929cef3626371b9e87afe1

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Thu Mar 25 18:16:54 2021 -0700

microsoft/compiler: Move blob_init earlier to prevent crash on failure

Reviewed-by: Bill Kristiansen <billkris at microsoft.com>
Acked-by: Michael Tang <tangm at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846>

---

 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;



More information about the mesa-commit mailing list