Henri Verbeet : wined3d: Resource size should always be non-zero in resource_init().
Alexandre Julliard
julliard at winehq.org
Mon Mar 19 18:32:49 CDT 2018
Module: wine
Branch: master
Commit: d3baf0355af7520144449a9ac098ee5c380661c1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d3baf0355af7520144449a9ac098ee5c380661c1
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Mar 19 00:27:07 2018 +0330
wined3d: Resource size should always be non-zero in resource_init().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/resource.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 97f7aec..8968c16 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -91,6 +91,9 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
return WINED3DERR_INVALIDCALL;
}
+ if (!size)
+ ERR("Attempting to create a zero-sized resource.\n");
+
for (i = 0; i < ARRAY_SIZE(resource_types); ++i)
{
if (resource_types[i].type != type
@@ -188,17 +191,10 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource->resource_ops = resource_ops;
resource->map_binding = WINED3D_LOCATION_SYSMEM;
- if (size)
- {
- if (!wined3d_resource_allocate_sysmem(resource))
- {
- ERR("Failed to allocate system memory.\n");
- return E_OUTOFMEMORY;
- }
- }
- else
+ if (!wined3d_resource_allocate_sysmem(resource))
{
- resource->heap_memory = NULL;
+ ERR("Failed to allocate system memory.\n");
+ return E_OUTOFMEMORY;
}
if (!(usage & WINED3DUSAGE_PRIVATE))
More information about the wine-cvs
mailing list