Commit b951c37b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d11: Use CRT allocation functions.

parent d8fa0ff1
......@@ -180,7 +180,7 @@ static void STDMETHODCALLTYPE d3d_query_wined3d_object_destroyed(void *parent)
struct d3d_query *query = parent;
wined3d_private_store_cleanup(&query->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_query_wined3d_parent_ops =
......@@ -488,13 +488,13 @@ HRESULT d3d_query_create(struct d3d_device *device, const D3D11_QUERY_DESC *desc
if (is_predicate_type)
predicate = TRUE;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_query_init(object, device, desc, predicate)))
{
WARN("Failed to initialise predicate, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
......@@ -396,7 +396,7 @@ static void STDMETHODCALLTYPE d3d_buffer_wined3d_object_released(void *parent)
struct d3d_buffer *buffer = parent;
if (buffer->dxgi_resource) IUnknown_Release(buffer->dxgi_resource);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_buffer_wined3d_parent_ops =
......@@ -507,13 +507,13 @@ HRESULT d3d_buffer_create(struct d3d_device *device, const D3D11_BUFFER_DESC *de
struct d3d_buffer *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_buffer_init(object, device, desc, data)))
{
WARN("Failed to initialise buffer, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
......@@ -20,7 +20,6 @@
#define __WINE_D3D11_PRIVATE_H
#include "wine/debug.h"
#include "wine/heap.h"
#include <assert.h>
......
......@@ -41,7 +41,7 @@ static BOOL d3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, S
if (new_capacity < count)
new_capacity = count;
if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
if (!(new_elements = realloc(*elements, new_capacity * size)))
return FALSE;
*elements = new_elements;
......@@ -158,9 +158,9 @@ static void d3d_device_context_state_private_release(struct d3d_device_context_s
d3d_device_remove_context_state(device, state);
}
heap_free(state->entries);
free(state->entries);
wined3d_device_decref(state->wined3d_device);
heap_free(state);
free(state);
}
}
......@@ -378,7 +378,7 @@ static ULONG STDMETHODCALLTYPE d3d11_command_list_Release(ID3D11CommandList *ifa
wined3d_command_list_decref(list->wined3d_list);
wined3d_private_store_cleanup(&list->private_store);
ID3D11Device2_Release(list->device);
heap_free(list);
free(list);
}
return refcount;
......@@ -528,7 +528,7 @@ static ULONG STDMETHODCALLTYPE d3d11_device_context_Release(ID3D11DeviceContext1
{
wined3d_deferred_context_destroy(context->wined3d_context);
d3d11_device_context_cleanup(context);
heap_free(context);
free(context);
}
ID3D11Device2_Release(device);
}
......@@ -2703,14 +2703,14 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_FinishCommandList(ID3D11De
return DXGI_ERROR_INVALID_CALL;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = wined3d_deferred_context_record_command_list(context->wined3d_context,
!!restore, &object->wined3d_list)))
{
WARN("Failed to record wined3d command list, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -3814,14 +3814,14 @@ static HRESULT d3d11_deferred_context_create(struct d3d_device *device,
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
d3d11_device_context_init(object, device, D3D11_DEVICE_CONTEXT_DEFERRED);
if (FAILED(hr = wined3d_deferred_context_create(device->wined3d_device, &object->wined3d_context)))
{
WARN("Failed to create wined3d deferred context, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -4385,7 +4385,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Dev
return S_FALSE;
}
if (!(state_impl = heap_alloc_zero(sizeof(*state_impl))))
if (!(state_impl = calloc(1, sizeof(*state_impl))))
{
wined3d_state_destroy(wined3d_state);
hr = E_OUTOFMEMORY;
......@@ -4600,7 +4600,7 @@ static ULONG STDMETHODCALLTYPE d3d_device_inner_Release(IUnknown *iface)
{
d3d_device_context_state_remove_entry(device->context_states[i], device);
}
heap_free(device->context_states);
free(device->context_states);
d3d11_device_context_cleanup(&device->immediate_context);
if (device->wined3d_device)
{
......@@ -6247,7 +6247,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
}
if (output_stream_decl_count
&& !(so_entries = heap_calloc(output_stream_decl_count, sizeof(*so_entries))))
&& !(so_entries = calloc(output_stream_decl_count, sizeof(*so_entries))))
{
ERR("Failed to allocate D3D11 SO declaration array memory.\n");
return E_OUTOFMEMORY;
......@@ -6268,7 +6268,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
if (output_stream_stride)
{
WARN("Stride must be 0 when multiple output slots are used.\n");
heap_free(so_entries);
free(so_entries);
return E_INVALIDARG;
}
}
......@@ -6276,7 +6276,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
hr = d3d_geometry_shader_create(device, byte_code, byte_code_length,
so_entries, output_stream_decl_count, &output_stream_stride, stride_count, 0, &object);
heap_free(so_entries);
free(so_entries);
if (FAILED(hr))
return hr;
......@@ -6799,7 +6799,7 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par
wined3d_state = wined3d_device_get_state(device->wined3d_device);
feature_level = d3d_feature_level_from_wined3d(wined3d_state_get_feature_level(wined3d_state));
if (!(state = heap_alloc_zero(sizeof(*state))))
if (!(state = calloc(1, sizeof(*state))))
{
ERR("Failed to create the initial device context state.\n");
return;
......
......@@ -57,10 +57,10 @@ static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEME
return E_FAIL;
}
if (!(*wined3d_elements = heap_calloc(element_count, sizeof(**wined3d_elements))))
if (!(*wined3d_elements = calloc(element_count, sizeof(**wined3d_elements))))
{
ERR("Failed to allocate wined3d vertex element array memory.\n");
heap_free(is.elements);
free(is.elements);
return E_OUTOFMEMORY;
}
......@@ -86,7 +86,7 @@ static HRESULT d3d11_input_layout_to_wined3d_declaration(const D3D11_INPUT_ELEME
WARN("Unused input element %u.\n", i);
}
heap_free(is.elements);
free(is.elements);
return S_OK;
}
......@@ -312,7 +312,7 @@ static void STDMETHODCALLTYPE d3d_input_layout_wined3d_object_destroyed(void *pa
struct d3d_input_layout *layout = parent;
wined3d_private_store_cleanup(&layout->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_input_layout_wined3d_parent_ops =
......@@ -344,7 +344,7 @@ static HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d
hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, element_count,
layout, &d3d_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
heap_free(wined3d_elements);
free(wined3d_elements);
if (FAILED(hr))
{
WARN("Failed to create wined3d vertex declaration, hr %#lx.\n", hr);
......@@ -367,14 +367,14 @@ HRESULT d3d_input_layout_create(struct d3d_device *device,
struct d3d_input_layout *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_input_layout_init(object, device, element_descs, element_count,
shader_byte_code, shader_byte_code_length)))
{
WARN("Failed to initialise input layout, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
......@@ -247,7 +247,7 @@ static void STDMETHODCALLTYPE d3d_vertex_shader_wined3d_object_destroyed(void *p
struct d3d_vertex_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_vertex_shader_wined3d_parent_ops =
......@@ -290,13 +290,13 @@ HRESULT d3d_vertex_shader_create(struct d3d_device *device, const void *byte_cod
struct d3d_vertex_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_vertex_shader_init(object, device, byte_code, byte_code_length)))
{
WARN("Failed to initialise vertex shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -445,7 +445,7 @@ static void STDMETHODCALLTYPE d3d11_hull_shader_wined3d_object_destroyed(void *p
struct d3d11_hull_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d11_hull_shader_wined3d_parent_ops =
......@@ -487,12 +487,12 @@ HRESULT d3d11_hull_shader_create(struct d3d_device *device, const void *byte_cod
struct d3d11_hull_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_hull_shader_init(object, device, byte_code, byte_code_length)))
{
heap_free(object);
free(object);
return hr;
}
......@@ -632,7 +632,7 @@ static void STDMETHODCALLTYPE d3d11_domain_shader_wined3d_object_destroyed(void
struct d3d11_domain_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d11_domain_shader_wined3d_parent_ops =
......@@ -674,12 +674,12 @@ HRESULT d3d11_domain_shader_create(struct d3d_device *device, const void *byte_c
struct d3d11_domain_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_domain_shader_init(object, device, byte_code, byte_code_length)))
{
heap_free(object);
free(object);
return hr;
}
......@@ -922,7 +922,7 @@ static void STDMETHODCALLTYPE d3d_geometry_shader_wined3d_object_destroyed(void
struct d3d_geometry_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_geometry_shader_wined3d_parent_ops =
......@@ -1161,14 +1161,14 @@ HRESULT d3d_geometry_shader_create(struct d3d_device *device, const void *byte_c
struct d3d_geometry_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_geometry_shader_init(object, device, byte_code, byte_code_length,
so_entries, so_entry_count, buffer_strides, buffer_stride_count, rasterizer_stream)))
{
WARN("Failed to initialise geometry shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -1420,7 +1420,7 @@ static void STDMETHODCALLTYPE d3d_pixel_shader_wined3d_object_destroyed(void *pa
struct d3d_pixel_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_pixel_shader_wined3d_parent_ops =
......@@ -1463,13 +1463,13 @@ HRESULT d3d_pixel_shader_create(struct d3d_device *device, const void *byte_code
struct d3d_pixel_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_pixel_shader_init(object, device, byte_code, byte_code_length)))
{
WARN("Failed to initialise pixel shader, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -1616,7 +1616,7 @@ static void STDMETHODCALLTYPE d3d11_compute_shader_wined3d_object_destroyed(void
struct d3d11_compute_shader *shader = parent;
wined3d_private_store_cleanup(&shader->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d11_compute_shader_wined3d_parent_ops =
......@@ -1658,12 +1658,12 @@ HRESULT d3d11_compute_shader_create(struct d3d_device *device, const void *byte_
struct d3d11_compute_shader *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_compute_shader_init(object, device, byte_code, byte_code_length)))
{
heap_free(object);
free(object);
return hr;
}
......@@ -1730,7 +1730,7 @@ static ULONG STDMETHODCALLTYPE d3d11_class_linkage_Release(ID3D11ClassLinkage *i
ID3D11Device2 *device = class_linkage->device;
wined3d_private_store_cleanup(&class_linkage->private_store);
heap_free(class_linkage);
free(class_linkage);
ID3D11Device2_Release(device);
}
......@@ -1819,7 +1819,7 @@ HRESULT d3d11_class_linkage_create(struct d3d_device *device, struct d3d11_class
{
struct d3d11_class_linkage *object;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->ID3D11ClassLinkage_iface.lpVtbl = &d3d11_class_linkage_vtbl;
......
......@@ -325,7 +325,7 @@ static void STDMETHODCALLTYPE d3d_blend_state_wined3d_object_destroyed(void *par
wine_rb_remove(&device->blend_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_blend_state_wined3d_parent_ops =
......@@ -406,7 +406,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
return S_OK;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
{
wined3d_mutex_unlock();
return E_OUTOFMEMORY;
......@@ -422,7 +422,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
{
ERR("Failed to insert blend state entry.\n");
wined3d_private_store_cleanup(&object->private_store);
heap_free(object);
free(object);
wined3d_mutex_unlock();
return E_FAIL;
}
......@@ -452,7 +452,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
WARN("Failed to create wined3d blend state, hr %#lx.\n", hr);
wined3d_private_store_cleanup(&object->private_store);
wine_rb_remove(&device->blend_states, &object->entry);
heap_free(object);
free(object);
wined3d_mutex_unlock();
return hr;
}
......@@ -730,7 +730,7 @@ static void STDMETHODCALLTYPE d3d_depthstencil_state_wined3d_object_destroyed(vo
wine_rb_remove(&device->depthstencil_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_depthstencil_state_wined3d_parent_ops =
......@@ -799,7 +799,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
return S_OK;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
{
wined3d_mutex_unlock();
return E_OUTOFMEMORY;
......@@ -815,7 +815,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
{
ERR("Failed to insert depth/stencil state entry.\n");
wined3d_private_store_cleanup(&object->private_store);
heap_free(object);
free(object);
wined3d_mutex_unlock();
return E_FAIL;
}
......@@ -843,7 +843,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
WARN("Failed to create wined3d depth/stencil state, hr %#lx.\n", hr);
wined3d_private_store_cleanup(&object->private_store);
wine_rb_remove(&device->depthstencil_states, &object->entry);
heap_free(object);
free(object);
wined3d_mutex_unlock();
return hr;
}
......@@ -1138,7 +1138,7 @@ static void STDMETHODCALLTYPE d3d_rasterizer_state_wined3d_object_destroyed(void
wine_rb_remove(&device->rasterizer_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_rasterizer_state_wined3d_parent_ops =
......@@ -1235,7 +1235,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE
return S_OK;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
{
wined3d_mutex_unlock();
return E_OUTOFMEMORY;
......@@ -1246,7 +1246,7 @@ HRESULT d3d_rasterizer_state_create(struct d3d_device *device, const D3D11_RASTE
if (FAILED(hr))
{
WARN("Failed to initialise rasterizer state, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -1524,7 +1524,7 @@ static void STDMETHODCALLTYPE d3d_sampler_wined3d_object_destroyed(void *parent)
wine_rb_remove(&device->sampler_states, &state->entry);
wined3d_private_store_cleanup(&state->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_sampler_wined3d_parent_ops =
......@@ -1653,7 +1653,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_
return S_OK;
}
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
{
wined3d_mutex_unlock();
return E_OUTOFMEMORY;
......@@ -1664,7 +1664,7 @@ HRESULT d3d_sampler_state_create(struct d3d_device *device, const D3D11_SAMPLER_
if (FAILED(hr))
{
WARN("Failed to initialise sampler state, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
......@@ -252,7 +252,7 @@ static void STDMETHODCALLTYPE d3d_texture1d_wined3d_object_released(void *parent
if (texture->dxgi_resource)
IUnknown_Release(texture->dxgi_resource);
heap_free(texture);
free(texture);
}
static ULONG STDMETHODCALLTYPE d3d10_texture1d_Release(ID3D10Texture1D *iface)
......@@ -447,7 +447,7 @@ HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DE
DWORD flags = 0;
HRESULT hr;
if (!(texture = heap_alloc_zero(sizeof(*texture))))
if (!(texture = calloc(1, sizeof(*texture))))
return E_OUTOFMEMORY;
texture->ID3D11Texture1D_iface.lpVtbl = &d3d11_texture1d_vtbl;
......@@ -481,7 +481,7 @@ HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DE
texture, &d3d_texture1d_wined3d_parent_ops, &texture->wined3d_texture)))
{
WARN("Failed to create wined3d texture, hr %#lx.\n", hr);
heap_free(texture);
free(texture);
wined3d_mutex_unlock();
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL)
hr = E_INVALIDARG;
......@@ -747,7 +747,7 @@ static void STDMETHODCALLTYPE d3d_texture2d_wined3d_object_released(void *parent
struct d3d_texture2d *texture = parent;
if (texture->dxgi_resource) IUnknown_Release(texture->dxgi_resource);
heap_free(texture);
free(texture);
}
static ULONG STDMETHODCALLTYPE d3d10_texture2d_Release(ID3D10Texture2D *iface)
......@@ -971,7 +971,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
return E_INVALIDARG;
}
if (!(texture = heap_alloc_zero(sizeof(*texture))))
if (!(texture = calloc(1, sizeof(*texture))))
return E_OUTOFMEMORY;
texture->ID3D11Texture2D_iface.lpVtbl = &d3d11_texture2d_vtbl;
......@@ -1005,7 +1005,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
texture, &d3d_texture2d_wined3d_parent_ops, &texture->wined3d_texture)))
{
WARN("Failed to create wined3d texture, hr %#lx.\n", hr);
heap_free(texture);
free(texture);
wined3d_mutex_unlock();
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DERR_INVALIDCALL)
hr = E_INVALIDARG;
......@@ -1099,7 +1099,7 @@ static void STDMETHODCALLTYPE d3d_texture3d_wined3d_object_released(void *parent
if (texture->dxgi_resource)
IUnknown_Release(texture->dxgi_resource);
heap_free(parent);
free(parent);
}
static ULONG STDMETHODCALLTYPE d3d11_texture3d_Release(ID3D11Texture3D *iface)
......@@ -1497,13 +1497,13 @@ HRESULT d3d_texture3d_create(struct d3d_device *device, const D3D11_TEXTURE3D_DE
struct d3d_texture3d *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_texture3d_init(object, device, desc, data)))
{
WARN("Failed to initialise texture, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
......@@ -1194,7 +1194,7 @@ static void STDMETHODCALLTYPE d3d_depth_stencil_view_wined3d_object_destroyed(vo
struct d3d_depthstencil_view *view = parent;
wined3d_private_store_cleanup(&view->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_depth_stencil_view_wined3d_parent_ops =
......@@ -1318,13 +1318,13 @@ HRESULT d3d_depthstencil_view_create(struct d3d_device *device, ID3D11Resource *
struct d3d_depthstencil_view *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_depthstencil_view_init(object, device, resource, desc)))
{
WARN("Failed to initialise depth/stencil view, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -1629,7 +1629,7 @@ static void STDMETHODCALLTYPE d3d_render_target_view_wined3d_object_destroyed(vo
struct d3d_rendertarget_view *view = parent;
wined3d_private_store_cleanup(&view->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_render_target_view_wined3d_parent_ops =
......@@ -1759,13 +1759,13 @@ HRESULT d3d_rendertarget_view_create(struct d3d_device *device, ID3D11Resource *
struct d3d_rendertarget_view *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_rendertarget_view_init(object, device, resource, desc)))
{
WARN("Failed to initialise rendertarget view, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -2084,7 +2084,7 @@ static void STDMETHODCALLTYPE d3d_shader_resource_view_wined3d_object_destroyed(
struct d3d_shader_resource_view *view = parent;
wined3d_private_store_cleanup(&view->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d_shader_resource_view_wined3d_parent_ops =
......@@ -2253,13 +2253,13 @@ HRESULT d3d_shader_resource_view_create(struct d3d_device *device, ID3D11Resourc
struct d3d_shader_resource_view *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d_shader_resource_view_init(object, device, resource, desc)))
{
WARN("Failed to initialise shader resource view, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......@@ -2427,7 +2427,7 @@ static void STDMETHODCALLTYPE d3d11_unordered_access_view_wined3d_object_destroy
struct d3d11_unordered_access_view *view = parent;
wined3d_private_store_cleanup(&view->private_store);
heap_free(parent);
free(parent);
}
static const struct wined3d_parent_ops d3d11_unordered_access_view_wined3d_parent_ops =
......@@ -2556,13 +2556,13 @@ HRESULT d3d11_unordered_access_view_create(struct d3d_device *device, ID3D11Reso
struct d3d11_unordered_access_view *object;
HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object))))
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d11_unordered_access_view_init(object, device, resource, desc)))
{
WARN("Failed to initialise unordered access view, hr %#lx.\n", hr);
heap_free(object);
free(object);
return hr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment