=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Simplify geometry_shader_init( ).

Alexandre Julliard julliard at winehq.org
Mon Apr 23 17:58:37 CDT 2018


Module: wine
Branch: master
Commit: 9d70df6a40b7830c67bcd078902e0ab6cc63a15f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9d70df6a40b7830c67bcd078902e0ab6cc63a15f

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Apr 23 16:20:15 2018 +0200

wined3d: Simplify geometry_shader_init().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/shader.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 8934c4f..cda812a 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3730,7 +3730,7 @@ static HRESULT geometry_shader_init(struct wined3d_shader *shader, struct wined3
         const struct wined3d_shader_desc *desc, const struct wined3d_stream_output_desc *so_desc,
         void *parent, const struct wined3d_parent_ops *parent_ops)
 {
-    struct wined3d_stream_output_element *elements = NULL;
+    struct wined3d_stream_output_element *elements;
     enum wined3d_shader_type shader_type;
     HRESULT hr;
 
@@ -3748,17 +3748,17 @@ static HRESULT geometry_shader_init(struct wined3d_shader *shader, struct wined3
         }
     }
 
-    if (so_desc && !(elements = heap_calloc(so_desc->element_count, sizeof(*elements))))
-        return E_OUTOFMEMORY;
-
     if (FAILED(hr = shader_init(shader, device, desc, 0, WINED3D_SHADER_TYPE_GEOMETRY, parent, parent_ops)))
-    {
-        heap_free(elements);
         return hr;
-    }
 
     if (so_desc)
     {
+        if (!(elements = heap_calloc(so_desc->element_count, sizeof(*elements))))
+        {
+            shader_cleanup(shader);
+            return E_OUTOFMEMORY;
+        }
+
         shader->u.gs.so_desc = *so_desc;
         shader->u.gs.so_desc.elements = elements;
         memcpy(elements, so_desc->elements, so_desc->element_count * sizeof(*elements));




More information about the wine-cvs mailing list