Matteo Bruni : vkd3d-shader: Cleanup predefined macro body on allocation failure.

Alexandre Julliard julliard at winehq.org
Wed Jan 27 15:34:55 CST 2021


Module: vkd3d
Branch: master
Commit: 1e01656def355b589f0602b51b67e3aa34df10c6
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=1e01656def355b589f0602b51b67e3aa34df10c6

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Jan 26 20:26:33 2021 +0100

vkd3d-shader: Cleanup predefined macro body on allocation failure.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/preproc.l | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l
index 82b6492..bf4d669 100644
--- a/libs/vkd3d-shader/preproc.l
+++ b/libs/vkd3d-shader/preproc.l
@@ -743,10 +743,14 @@ int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info,
         vkd3d_string_buffer_init(&body);
         vkd3d_string_buffer_printf(&body, "%s", ctx.preprocess_info->macros[i].value);
         if (!(name = vkd3d_strdup(ctx.preprocess_info->macros[i].name)))
+        {
+            vkd3d_string_buffer_cleanup(&body);
             goto fail;
+        }
         if (!preproc_add_macro(&ctx, &loc, name, NULL, 0, &loc, &body))
         {
             vkd3d_free(name);
+            vkd3d_string_buffer_cleanup(&body);
             goto fail;
         }
     }




More information about the wine-cvs mailing list