=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Do not call wined3d_buffer_map () before "buffer->maps" is initialized.

Alexandre Julliard julliard at winehq.org
Fri May 27 09:42:33 CDT 2016


Module: wine
Branch: master
Commit: 0dcf255b51ef096d649a5b4daee7204409550376
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0dcf255b51ef096d649a5b4daee7204409550376

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri May 27 11:03:54 2016 +0200

wined3d: Do not call wined3d_buffer_map() before "buffer->maps" is initialized.

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/buffer.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index c82bfdb..62a1921 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1331,17 +1331,6 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
         buffer->flags |= WINED3D_BUFFER_CREATEBO;
     }
 
-    if (data)
-    {
-        if (FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data)))
-        {
-            ERR("Failed to upload data, hr %#x.\n", hr);
-            buffer_unload(&buffer->resource);
-            resource_cleanup(&buffer->resource);
-            return hr;
-        }
-    }
-
     if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps))))
     {
         ERR("Out of memory.\n");
@@ -1351,6 +1340,15 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
     }
     buffer->maps_size = 1;
 
+    if (data && FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data)))
+    {
+        ERR("Failed to upload data, hr %#x.\n", hr);
+        buffer_unload(&buffer->resource);
+        resource_cleanup(&buffer->resource);
+        HeapFree(GetProcessHeap(), 0, buffer->maps);
+        return hr;
+    }
+
     return WINED3D_OK;
 }
 




More information about the wine-cvs mailing list