Commit 55fbd32b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Use CRT allocation functions.

parent 463af41f
...@@ -211,7 +211,7 @@ static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface) ...@@ -211,7 +211,7 @@ static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
static void d3drm_destroy(struct d3drm *d3drm) static void d3drm_destroy(struct d3drm *d3drm)
{ {
TRACE("d3drm object %p is being destroyed.\n", d3drm); TRACE("d3drm object %p is being destroyed.\n", d3drm);
heap_free(d3drm); free(d3drm);
} }
static HRESULT WINAPI d3drm1_QueryInterface(IDirect3DRM *iface, REFIID riid, void **out) static HRESULT WINAPI d3drm1_QueryInterface(IDirect3DRM *iface, REFIID riid, void **out)
...@@ -2325,7 +2325,7 @@ HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm) ...@@ -2325,7 +2325,7 @@ HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
TRACE("d3drm %p.\n", d3drm); TRACE("d3drm %p.\n", d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl; object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl;
......
...@@ -43,7 +43,7 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE ...@@ -43,7 +43,7 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE
if (!cb) if (!cb)
return D3DRMERR_BADVALUE; return D3DRMERR_BADVALUE;
if (!(callback = heap_alloc(sizeof(*callback)))) if (!(callback = malloc(sizeof(*callback))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
callback->cb = cb; callback->cb = cb;
...@@ -65,7 +65,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO ...@@ -65,7 +65,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO
if (callback->cb == cb && callback->ctx == ctx) if (callback->cb == cb && callback->ctx == ctx)
{ {
list_remove(&callback->entry); list_remove(&callback->entry);
heap_free(callback); free(callback);
break; break;
} }
} }
...@@ -120,13 +120,13 @@ HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) ...@@ -120,13 +120,13 @@ HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
{ {
DWORD req_size; DWORD req_size;
heap_free(object->name); free(object->name);
object->name = NULL; object->name = NULL;
if (name) if (name)
{ {
req_size = strlen(name) + 1; req_size = strlen(name) + 1;
if (!(object->name = heap_alloc(req_size))) if (!(object->name = malloc(req_size)))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(object->name, name, req_size); memcpy(object->name, name, req_size);
} }
...@@ -142,9 +142,9 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) ...@@ -142,9 +142,9 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
{ {
callback->cb(iface, callback->ctx); callback->cb(iface, callback->ctx);
list_remove(&callback->entry); list_remove(&callback->entry);
heap_free(callback); free(callback);
} }
heap_free(object->name); free(object->name);
object->name = NULL; object->name = NULL;
} }
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "d3drmwin.h" #include "d3drmwin.h"
#include "rmxfguid.h" #include "rmxfguid.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
struct d3drm_matrix struct d3drm_matrix
......
...@@ -58,7 +58,7 @@ void d3drm_device_destroy(struct d3drm_device *device) ...@@ -58,7 +58,7 @@ void d3drm_device_destroy(struct d3drm_device *device)
IDirectDraw_Release(device->ddraw); IDirectDraw_Release(device->ddraw);
IDirect3DRM_Release(device->d3drm); IDirect3DRM_Release(device->d3drm);
} }
heap_free(device); free(device);
} }
static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface) static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
...@@ -1660,7 +1660,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) ...@@ -1660,7 +1660,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
TRACE("device %p, d3drm %p.\n", device, d3drm); TRACE("device %p, d3drm %p.\n", device, d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl; object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl;
......
...@@ -79,7 +79,7 @@ static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface) ...@@ -79,7 +79,7 @@ static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
if (!refcount) if (!refcount)
{ {
d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj); d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
heap_free(face); free(face);
} }
return refcount; return refcount;
...@@ -624,7 +624,7 @@ HRESULT d3drm_face_create(struct d3drm_face **face) ...@@ -624,7 +624,7 @@ HRESULT d3drm_face_create(struct d3drm_face **face)
TRACE("face %p.\n", face); TRACE("face %p.\n", face);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl; object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
......
...@@ -206,8 +206,8 @@ static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface) ...@@ -206,8 +206,8 @@ static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface)
{ {
IDirect3DRMFrame_Release(array->frames[i]); IDirect3DRMFrame_Release(array->frames[i]);
} }
heap_free(array->frames); free(array->frames);
heap_free(array); free(array);
} }
return refcount; return refcount;
...@@ -258,7 +258,7 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou ...@@ -258,7 +258,7 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
struct d3drm_frame_array *array; struct d3drm_frame_array *array;
unsigned int i; unsigned int i;
if (!(array = heap_alloc_zero(sizeof(*array)))) if (!(array = calloc(1, sizeof(*array))))
return NULL; return NULL;
array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl; array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
...@@ -267,9 +267,9 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou ...@@ -267,9 +267,9 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
if (frame_count) if (frame_count)
{ {
if (!(array->frames = heap_calloc(frame_count, sizeof(*array->frames)))) if (!(array->frames = calloc(frame_count, sizeof(*array->frames))))
{ {
heap_free(array); free(array);
return NULL; return NULL;
} }
...@@ -324,8 +324,8 @@ static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface) ...@@ -324,8 +324,8 @@ static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
{ {
IDirect3DRMVisual_Release(array->visuals[i]); IDirect3DRMVisual_Release(array->visuals[i]);
} }
heap_free(array->visuals); free(array->visuals);
heap_free(array); free(array);
} }
return refcount; return refcount;
...@@ -376,7 +376,7 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_ ...@@ -376,7 +376,7 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
struct d3drm_visual_array *array; struct d3drm_visual_array *array;
unsigned int i; unsigned int i;
if (!(array = heap_alloc_zero(sizeof(*array)))) if (!(array = calloc(1, sizeof(*array))))
return NULL; return NULL;
array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl; array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
...@@ -385,9 +385,9 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_ ...@@ -385,9 +385,9 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
if (visual_count) if (visual_count)
{ {
if (!(array->visuals = heap_calloc(visual_count, sizeof(*array->visuals)))) if (!(array->visuals = calloc(visual_count, sizeof(*array->visuals))))
{ {
heap_free(array); free(array);
return NULL; return NULL;
} }
...@@ -443,8 +443,8 @@ static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface) ...@@ -443,8 +443,8 @@ static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface)
{ {
IDirect3DRMLight_Release(array->lights[i]); IDirect3DRMLight_Release(array->lights[i]);
} }
heap_free(array->lights); free(array->lights);
heap_free(array); free(array);
} }
return refcount; return refcount;
...@@ -495,7 +495,7 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou ...@@ -495,7 +495,7 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
struct d3drm_light_array *array; struct d3drm_light_array *array;
unsigned int i; unsigned int i;
if (!(array = heap_alloc_zero(sizeof(*array)))) if (!(array = calloc(1, sizeof(*array))))
return NULL; return NULL;
array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl; array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
...@@ -504,9 +504,9 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou ...@@ -504,9 +504,9 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
if (light_count) if (light_count)
{ {
if (!(array->lights = heap_calloc(light_count, sizeof(*array->lights)))) if (!(array->lights = calloc(light_count, sizeof(*array->lights))))
{ {
heap_free(array); free(array);
return NULL; return NULL;
} }
...@@ -613,19 +613,19 @@ static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface) ...@@ -613,19 +613,19 @@ static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface)
{ {
IDirect3DRMFrame3_Release(frame->children[i]); IDirect3DRMFrame3_Release(frame->children[i]);
} }
heap_free(frame->children); free(frame->children);
for (i = 0; i < frame->nb_visuals; ++i) for (i = 0; i < frame->nb_visuals; ++i)
{ {
IDirect3DRMVisual_Release(frame->visuals[i]); IDirect3DRMVisual_Release(frame->visuals[i]);
} }
heap_free(frame->visuals); free(frame->visuals);
for (i = 0; i < frame->nb_lights; ++i) for (i = 0; i < frame->nb_lights; ++i)
{ {
IDirect3DRMLight_Release(frame->lights[i]); IDirect3DRMLight_Release(frame->lights[i]);
} }
heap_free(frame->lights); free(frame->lights);
IDirect3DRM_Release(frame->d3drm); IDirect3DRM_Release(frame->d3drm);
heap_free(frame); free(frame);
} }
return refcount; return refcount;
...@@ -3134,7 +3134,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I ...@@ -3134,7 +3134,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm); TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl; object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl;
...@@ -3155,7 +3155,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I ...@@ -3155,7 +3155,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p))) if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p)))
{ {
heap_free(object); free(object);
return hr; return hr;
} }
IDirect3DRMFrame_Release(parent_frame); IDirect3DRMFrame_Release(parent_frame);
...@@ -3232,10 +3232,10 @@ static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface) ...@@ -3232,10 +3232,10 @@ static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface)
{ {
d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj); d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
IDirect3DRM_Release(animation->d3drm); IDirect3DRM_Release(animation->d3drm);
heap_free(animation->rotate.keys); free(animation->rotate.keys);
heap_free(animation->scale.keys); free(animation->scale.keys);
heap_free(animation->position.keys); free(animation->position.keys);
heap_free(animation); free(animation);
} }
return refcount; return refcount;
...@@ -3886,7 +3886,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM * ...@@ -3886,7 +3886,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *
TRACE("animation %p, d3drm %p.\n", animation, d3drm); TRACE("animation %p, d3drm %p.\n", animation, d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl; object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
......
...@@ -67,7 +67,7 @@ static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface) ...@@ -67,7 +67,7 @@ static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface)
{ {
d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj); d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
IDirect3DRM_Release(light->d3drm); IDirect3DRM_Release(light->d3drm);
heap_free(light); free(light);
} }
return refcount; return refcount;
...@@ -375,7 +375,7 @@ HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) ...@@ -375,7 +375,7 @@ HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
TRACE("light %p.\n", light); TRACE("light %p.\n", light);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl; object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
......
...@@ -68,7 +68,7 @@ static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface) ...@@ -68,7 +68,7 @@ static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface)
{ {
d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj); d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
IDirect3DRM_Release(material->d3drm); IDirect3DRM_Release(material->d3drm);
heap_free(material); free(material);
} }
return refcount; return refcount;
...@@ -283,7 +283,7 @@ HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3d ...@@ -283,7 +283,7 @@ HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3d
TRACE("material %p, d3drm %p.\n", material, d3drm); TRACE("material %p, d3drm %p.\n", material, d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl; object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
......
...@@ -47,7 +47,7 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture) ...@@ -47,7 +47,7 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture)
IDirect3DRM_Release(texture->d3drm); IDirect3DRM_Release(texture->d3drm);
if (texture->surface) if (texture->surface)
IDirectDrawSurface_Release(texture->surface); IDirectDrawSurface_Release(texture->surface);
heap_free(texture); free(texture);
} }
static BOOL d3drm_validate_image(D3DRMIMAGE *image) static BOOL d3drm_validate_image(D3DRMIMAGE *image)
...@@ -79,17 +79,17 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, ...@@ -79,17 +79,17 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data,
src_pitch = flip ? -w * 3 : w * 3; src_pitch = flip ? -w * 3 : w * 3;
dst_pitch = (w + 3) & ~3; dst_pitch = (w + 3) & ~3;
if (!(dst_data = heap_alloc(dst_pitch * h))) if (!(dst_data = malloc(dst_pitch * h)))
{ {
WARN("Failed to allocate image buffer.\n"); WARN("Failed to allocate image buffer.\n");
return FALSE; return FALSE;
} }
memset(dst_data, 0xff, dst_pitch * h); memset(dst_data, 0xff, dst_pitch * h);
if (!(palette = heap_alloc(256 * sizeof(*palette)))) if (!(palette = malloc(256 * sizeof(*palette))))
{ {
WARN("Failed to allocate palette.\n"); WARN("Failed to allocate palette.\n");
heap_free(dst_data); free(dst_data);
return FALSE; return FALSE;
} }
...@@ -113,8 +113,8 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, ...@@ -113,8 +113,8 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data,
{ {
if (colour_count == 256) if (colour_count == 256)
{ {
heap_free(dst_data); free(dst_data);
heap_free(palette); free(palette);
return FALSE; return FALSE;
} }
...@@ -140,7 +140,7 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, ...@@ -140,7 +140,7 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data,
image->green_mask = 0xff; image->green_mask = 0xff;
image->blue_mask = 0xff; image->blue_mask = 0xff;
image->palette_size = colour_count; image->palette_size = colour_count;
if (!(image->palette = heap_realloc(palette, colour_count * sizeof(*palette)))) if (!(image->palette = realloc(palette, colour_count * sizeof(*palette))))
image->palette = palette; image->palette = palette;
return TRUE; return TRUE;
...@@ -161,7 +161,7 @@ static HRESULT d3drm_image_load_32(D3DRMIMAGE *image, unsigned char *src_data, ...@@ -161,7 +161,7 @@ static HRESULT d3drm_image_load_32(D3DRMIMAGE *image, unsigned char *src_data,
src_pitch = flip ? -w * 3 : w * 3; src_pitch = flip ? -w * 3 : w * 3;
dst_pitch = w * 4; dst_pitch = w * 4;
if (!(dst_data = heap_alloc(dst_pitch * h))) if (!(dst_data = malloc(dst_pitch * h)))
{ {
WARN("Failed to allocate image buffer.\n"); WARN("Failed to allocate image buffer.\n");
return D3DRMERR_BADALLOC; return D3DRMERR_BADALLOC;
...@@ -206,16 +206,16 @@ static HRESULT d3drm_image_load_8(D3DRMIMAGE *image, const RGBQUAD *palette, ...@@ -206,16 +206,16 @@ static HRESULT d3drm_image_load_8(D3DRMIMAGE *image, const RGBQUAD *palette,
if (w > ~(SIZE_T)0 / h) if (w > ~(SIZE_T)0 / h)
return D3DRMERR_BADALLOC; return D3DRMERR_BADALLOC;
if (!(dst_data = heap_alloc(w * h))) if (!(dst_data = malloc(w * h)))
{ {
WARN("Failed to allocate image buffer.\n"); WARN("Failed to allocate image buffer.\n");
return D3DRMERR_BADALLOC; return D3DRMERR_BADALLOC;
} }
if (!(image->palette = heap_alloc(256 * sizeof(*image->palette)))) if (!(image->palette = malloc(256 * sizeof(*image->palette))))
{ {
WARN("Failed to allocate palette.\n"); WARN("Failed to allocate palette.\n");
heap_free(dst_data); free(dst_data);
return D3DRMERR_BADALLOC; return D3DRMERR_BADALLOC;
} }
...@@ -257,8 +257,8 @@ static void CDECL destroy_image_callback(IDirect3DRMObject *obj, void *arg) ...@@ -257,8 +257,8 @@ static void CDECL destroy_image_callback(IDirect3DRMObject *obj, void *arg)
TRACE("texture object %p, image %p.\n", obj, image); TRACE("texture object %p, image %p.\n", obj, image);
heap_free(image->buffer1); free(image->buffer1);
heap_free(image); free(image);
} }
static HRESULT d3drm_texture_load(struct d3drm_texture *texture, static HRESULT d3drm_texture_load(struct d3drm_texture *texture,
...@@ -294,7 +294,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture, ...@@ -294,7 +294,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture,
return D3DRMERR_BADVALUE; return D3DRMERR_BADVALUE;
hr = D3DRMERR_BADALLOC; hr = D3DRMERR_BADALLOC;
if (!(image = heap_alloc_zero(sizeof(*image)))) if (!(image = calloc(1, sizeof(*image))))
goto fail; goto fail;
hr = D3DRMERR_BADFILE; hr = D3DRMERR_BADFILE;
...@@ -344,7 +344,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture, ...@@ -344,7 +344,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture,
return hr; return hr;
fail: fail:
heap_free(image); free(image);
UnmapViewOfFile(header); UnmapViewOfFile(header);
return hr; return hr;
...@@ -1450,7 +1450,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) ...@@ -1450,7 +1450,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
TRACE("texture %p.\n", texture); TRACE("texture %p.\n", texture);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl; object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
......
...@@ -73,7 +73,7 @@ static void d3drm_viewport_destroy(struct d3drm_viewport *viewport) ...@@ -73,7 +73,7 @@ static void d3drm_viewport_destroy(struct d3drm_viewport *viewport)
IDirect3DRM_Release(viewport->d3drm); IDirect3DRM_Release(viewport->d3drm);
} }
heap_free(viewport); free(viewport);
} }
static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out) static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out)
...@@ -1133,7 +1133,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d ...@@ -1133,7 +1133,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm); TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl; object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
......
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