1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

uiautomationcore: Use CRT allocation functions.

This commit is contained in:
Alex Henrie 2023-09-01 21:36:24 -06:00 committed by Alexandre Julliard
parent f62464dd46
commit d89665847f
7 changed files with 99 additions and 103 deletions

View File

@ -39,7 +39,7 @@ static void clear_node_array(struct uia_node_array *nodes)
for (i = 0; i < nodes->node_count; i++)
UiaNodeRelease(nodes->nodes[i]);
heap_free(nodes->nodes);
free(nodes->nodes);
}
memset(nodes, 0, sizeof(*nodes));
@ -429,7 +429,7 @@ static ULONG WINAPI uia_node_Release(IWineUiaNode *iface)
if (node->nested_node)
uia_stop_provider_thread();
heap_free(node);
free(node);
}
return ref;
@ -697,7 +697,7 @@ HRESULT clone_uia_node(HUIANODE in_node, HUIANODE *out_node)
}
}
if (!(node = heap_alloc_zero(sizeof(*node))))
if (!(node = calloc(1, sizeof(*node))))
return E_OUTOFMEMORY;
node->IWineUiaNode_iface.lpVtbl = &uia_node_vtbl;
@ -1327,7 +1327,7 @@ static ULONG WINAPI uia_provider_Release(IWineUiaProvider *iface)
if (!ref)
{
IRawElementProviderSimple_Release(prov->elprov);
heap_free(prov);
free(prov);
}
return ref;
@ -1919,7 +1919,7 @@ static const IWineUiaProviderVtbl uia_provider_vtbl = {
static HRESULT create_wine_uia_provider(struct uia_node *node, IRawElementProviderSimple *elprov,
int prov_type)
{
struct uia_provider *prov = heap_alloc_zero(sizeof(*prov));
struct uia_provider *prov = calloc(1, sizeof(*prov));
if (!prov)
return E_OUTOFMEMORY;
@ -1967,7 +1967,7 @@ HRESULT create_uia_node_from_elprov(IRawElementProviderSimple *elprov, HUIANODE
else
prov_type = PROV_TYPE_MAIN;
node = heap_alloc_zero(sizeof(*node));
node = calloc(1, sizeof(*node));
if (!node)
return E_OUTOFMEMORY;
@ -1980,7 +1980,7 @@ HRESULT create_uia_node_from_elprov(IRawElementProviderSimple *elprov, HUIANODE
hr = create_wine_uia_provider(node, elprov, prov_type);
if (FAILED(hr))
{
heap_free(node);
free(node);
return hr;
}
@ -2222,7 +2222,7 @@ static ULONG WINAPI uia_nested_node_provider_Release(IWineUiaProvider *iface)
{
IWineUiaNode_Release(prov->nested_node);
uia_stop_client_thread();
heap_free(prov);
free(prov);
}
return ref;
@ -2447,7 +2447,7 @@ static HRESULT create_wine_uia_nested_node_provider(struct uia_node *node, LRESU
}
else
{
prov = heap_alloc_zero(sizeof(*prov));
prov = calloc(1, sizeof(*prov));
if (!prov)
return E_OUTOFMEMORY;
@ -2493,7 +2493,7 @@ HRESULT uia_node_from_lresult(LRESULT lr, HUIANODE *huianode)
HRESULT hr;
*huianode = NULL;
node = heap_alloc_zero(sizeof(*node));
node = calloc(1, sizeof(*node));
if (!node)
return E_OUTOFMEMORY;
@ -2506,7 +2506,7 @@ HRESULT uia_node_from_lresult(LRESULT lr, HUIANODE *huianode)
hr = create_wine_uia_nested_node_provider(node, lr, FALSE);
if (FAILED(hr))
{
heap_free(node);
free(node);
return hr;
}
@ -2577,7 +2577,7 @@ HRESULT WINAPI UiaNodeFromHandle(HWND hwnd, HUIANODE *huianode)
if (!IsWindow(hwnd))
return UIA_E_ELEMENTNOTAVAILABLE;
node = heap_alloc_zero(sizeof(*node));
node = calloc(1, sizeof(*node));
if (!node)
return E_OUTOFMEMORY;
@ -2590,7 +2590,7 @@ HRESULT WINAPI UiaNodeFromHandle(HWND hwnd, HUIANODE *huianode)
hr = uia_get_providers_for_hwnd(node);
if (FAILED(hr))
{
heap_free(node);
free(node);
return hr;
}
@ -3515,7 +3515,7 @@ HRESULT WINAPI UiaFind(HUIANODE huianode, struct UiaFindParams *find_params, str
goto exit;
}
if (!(tmp_reqs = heap_alloc_zero(sizeof(*tmp_reqs) * nodes.node_count)))
if (!(tmp_reqs = calloc(nodes.node_count, sizeof(*tmp_reqs))))
{
hr = E_OUTOFMEMORY;
goto exit;
@ -3555,7 +3555,7 @@ HRESULT WINAPI UiaFind(HUIANODE huianode, struct UiaFindParams *find_params, str
if (nodes.node_count == 1)
{
req = tmp_reqs[0];
heap_free(tmp_reqs);
free(tmp_reqs);
tmp_reqs = NULL;
}
else
@ -3586,7 +3586,7 @@ exit:
{
for (i = 0; i < nodes.node_count; i++)
SafeArrayDestroy(tmp_reqs[i]);
heap_free(tmp_reqs);
free(tmp_reqs);
}
if (FAILED(hr))

View File

@ -84,9 +84,9 @@ static ULONG WINAPI uia_or_condition_Release(IUIAutomationOrCondition *iface)
}
}
heap_free(uia_or_condition->child_ifaces);
heap_free(uia_or_condition->condition.ppConditions);
heap_free(uia_or_condition);
free(uia_or_condition->child_ifaces);
free(uia_or_condition->condition.ppConditions);
free(uia_or_condition);
}
return ref;
@ -164,21 +164,21 @@ static HRESULT create_uia_or_condition_iface(IUIAutomationCondition **out_cond,
*out_cond = NULL;
uia_or_condition = heap_alloc_zero(sizeof(*uia_or_condition));
uia_or_condition = calloc(1, sizeof(*uia_or_condition));
if (!uia_or_condition)
return E_OUTOFMEMORY;
uia_or_condition->IUIAutomationOrCondition_iface.lpVtbl = &uia_or_condition_vtbl;
uia_or_condition->ref = 1;
uia_or_condition->child_ifaces = heap_alloc_zero(sizeof(*in_conds) * in_cond_count);
uia_or_condition->child_ifaces = calloc(in_cond_count, sizeof(*in_conds));
if (!uia_or_condition->child_ifaces)
{
IUIAutomationOrCondition_Release(&uia_or_condition->IUIAutomationOrCondition_iface);
return E_OUTOFMEMORY;
}
uia_or_condition->condition.ppConditions = heap_alloc_zero(sizeof(*uia_or_condition->condition.ppConditions) * in_cond_count);
uia_or_condition->condition.ppConditions = calloc(in_cond_count, sizeof(*uia_or_condition->condition.ppConditions));
if (!uia_or_condition->condition.ppConditions)
{
IUIAutomationOrCondition_Release(&uia_or_condition->IUIAutomationOrCondition_iface);
@ -253,7 +253,7 @@ static ULONG WINAPI uia_not_condition_Release(IUIAutomationNotCondition *iface)
if (!ref)
{
IUIAutomationCondition_Release(uia_not_condition->child_iface);
heap_free(uia_not_condition);
free(uia_not_condition);
}
return ref;
@ -295,7 +295,7 @@ static HRESULT create_uia_not_condition_iface(IUIAutomationCondition **out_cond,
if (FAILED(hr))
return hr;
uia_not_condition = heap_alloc_zero(sizeof(*uia_not_condition));
uia_not_condition = calloc(1, sizeof(*uia_not_condition));
if (!uia_not_condition)
return E_OUTOFMEMORY;
@ -357,7 +357,7 @@ static ULONG WINAPI uia_property_condition_Release(IUIAutomationPropertyConditio
if (!ref)
{
VariantClear(&uia_property_condition->condition.Value);
heap_free(uia_property_condition);
free(uia_property_condition);
}
return ref;
@ -445,7 +445,7 @@ static HRESULT create_uia_property_condition_iface(IUIAutomationCondition **out_
return E_NOTIMPL;
}
uia_property_condition = heap_alloc_zero(sizeof(*uia_property_condition));
uia_property_condition = calloc(1, sizeof(*uia_property_condition));
if (!uia_property_condition)
return E_OUTOFMEMORY;
@ -504,7 +504,7 @@ static ULONG WINAPI uia_bool_condition_Release(IUIAutomationBoolCondition *iface
TRACE("%p, refcount %ld\n", uia_bool_condition, ref);
if (!ref)
heap_free(uia_bool_condition);
free(uia_bool_condition);
return ref;
}
@ -540,7 +540,7 @@ static HRESULT create_uia_bool_condition_iface(IUIAutomationCondition **out_cond
if (!out_cond)
return E_POINTER;
uia_bool_condition = heap_alloc_zero(sizeof(*uia_bool_condition));
uia_bool_condition = calloc(1, sizeof(*uia_bool_condition));
if (!uia_bool_condition)
return E_OUTOFMEMORY;
@ -673,8 +673,8 @@ static ULONG WINAPI uia_cache_request_Release(IUIAutomationCacheRequest *iface)
if (!ref)
{
IUIAutomationCondition_Release(uia_cache_request->view_condition);
heap_free(uia_cache_request->prop_ids);
heap_free(uia_cache_request);
free(uia_cache_request->prop_ids);
free(uia_cache_request);
}
return ref;
@ -861,7 +861,7 @@ static HRESULT create_uia_cache_request_iface(IUIAutomationCacheRequest **out_ca
if (FAILED(hr))
return hr;
uia_cache_request = heap_alloc_zero(sizeof(*uia_cache_request));
uia_cache_request = calloc(1, sizeof(*uia_cache_request));
if (!uia_cache_request)
{
IUIAutomationCondition_Release(view_condition);
@ -975,7 +975,7 @@ static HRESULT uia_event_handlers_add_handler(IUnknown *handler_iface, SAFEARRAY
event_map = RB_ENTRY_VALUE(rb_entry, struct uia_event_handler_map_entry, entry);
else
{
if (!(event_map = heap_alloc_zero(sizeof(*event_map))))
if (!(event_map = calloc(1, sizeof(*event_map))))
{
hr = E_OUTOFMEMORY;
goto exit;
@ -984,7 +984,7 @@ static HRESULT uia_event_handlers_add_handler(IUnknown *handler_iface, SAFEARRAY
hr = SafeArrayCopy(runtime_id, &event_map->runtime_id);
if (FAILED(hr))
{
heap_free(event_map);
free(event_map);
goto exit;
}
@ -1013,7 +1013,7 @@ static void uia_event_handler_destroy(struct uia_com_event *event)
UiaRemoveEvent(event->event);
if (event->git_cookie)
unregister_interface_in_git(event->git_cookie);
heap_free(event);
free(event);
}
static void uia_event_handler_map_entry_destroy(struct uia_event_handler_map_entry *entry)
@ -1029,7 +1029,7 @@ static void uia_event_handler_map_entry_destroy(struct uia_event_handler_map_ent
rb_remove(&com_event_handlers.handler_map, &entry->entry);
IUnknown_Release(entry->handler_iface);
SafeArrayDestroy(entry->runtime_id);
heap_free(entry);
free(entry);
}
static void uia_event_handlers_remove_handlers(IUnknown *handler_iface, SAFEARRAY *runtime_id, int event_id)
@ -1153,8 +1153,8 @@ static ULONG WINAPI uia_element_array_Release(IUIAutomationElementArray *iface)
IUIAutomationElement_Release(element_arr->elements[i]);
}
}
heap_free(element_arr->elements);
heap_free(element_arr);
free(element_arr->elements);
free(element_arr);
}
return ref;
@ -1203,7 +1203,7 @@ static const IUIAutomationElementArrayVtbl uia_element_array_vtbl = {
static HRESULT create_uia_element_array_iface(IUIAutomationElementArray **iface, int elements_count)
{
struct uia_element_array *element_arr = heap_alloc_zero(sizeof(*element_arr));
struct uia_element_array *element_arr = calloc(1, sizeof(*element_arr));
*iface = NULL;
if (!element_arr)
@ -1212,9 +1212,9 @@ static HRESULT create_uia_element_array_iface(IUIAutomationElementArray **iface,
element_arr->IUIAutomationElementArray_iface.lpVtbl = &uia_element_array_vtbl;
element_arr->ref = 1;
element_arr->elements_count = elements_count;
if (!(element_arr->elements = heap_alloc_zero(sizeof(*element_arr->elements) * elements_count)))
if (!(element_arr->elements = calloc(elements_count, sizeof(*element_arr->elements))))
{
heap_free(element_arr);
free(element_arr);
return E_OUTOFMEMORY;
}
@ -1293,9 +1293,9 @@ static ULONG WINAPI uia_element_Release(IUIAutomationElement9 *iface)
}
IUnknown_Release(element->marshal);
heap_free(element->cached_props);
free(element->cached_props);
UiaNodeRelease(element->node);
heap_free(element);
free(element);
}
return ref;
@ -2539,7 +2539,7 @@ static const IUIAutomationElement9Vtbl uia_element_vtbl = {
static HRESULT create_uia_element(IUIAutomationElement **iface, BOOL from_cui8, HUIANODE node)
{
struct uia_element *element = heap_alloc_zero(sizeof(*element));
struct uia_element *element = calloc(1, sizeof(*element));
HRESULT hr;
*iface = NULL;
@ -2554,7 +2554,7 @@ static HRESULT create_uia_element(IUIAutomationElement **iface, BOOL from_cui8,
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&element->IUIAutomationElement9_iface, &element->marshal);
if (FAILED(hr))
{
heap_free(element);
free(element);
return hr;
}
@ -2603,7 +2603,7 @@ static HRESULT create_uia_element_from_cache_req(IUIAutomationElement **iface, B
{
LONG i;
elem_data->cached_props = heap_alloc_zero(sizeof(*elem_data->cached_props) * cache_req->cProperties);
elem_data->cached_props = calloc(cache_req->cProperties, sizeof(*elem_data->cached_props));
if (!elem_data->cached_props)
{
hr = E_OUTOFMEMORY;
@ -2702,7 +2702,7 @@ static ULONG WINAPI uia_tree_walker_Release(IUIAutomationTreeWalker *iface)
if (tree_walker->default_cache_req)
IUIAutomationCacheRequest_Release(tree_walker->default_cache_req);
IUIAutomationCondition_Release(tree_walker->nav_cond);
heap_free(tree_walker);
free(tree_walker);
}
return ref;
@ -2895,7 +2895,7 @@ static HRESULT create_uia_tree_walker(IUIAutomationTreeWalker **out_tree_walker,
if (FAILED(hr))
return hr;
tree_walker = heap_alloc_zero(sizeof(*tree_walker));
tree_walker = calloc(1, sizeof(*tree_walker));
if (!tree_walker)
return E_OUTOFMEMORY;
@ -2968,7 +2968,7 @@ static ULONG WINAPI uia_iface_Release(IUIAutomation6 *iface)
TRACE("%p, refcount %ld\n", uia_iface, ref);
if (!ref)
heap_free(uia_iface);
free(uia_iface);
return ref;
}
@ -3288,7 +3288,7 @@ static HRESULT uia_add_com_event_handler(IUIAutomation6 *iface, EVENTID event_id
if (FAILED(hr))
goto exit;
if (!(com_event = heap_alloc_zero(sizeof(*com_event))))
if (!(com_event = calloc(1, sizeof(*com_event))))
{
hr = E_OUTOFMEMORY;
goto exit;
@ -3925,7 +3925,7 @@ HRESULT create_uia_iface(IUnknown **iface, BOOL is_cui8)
{
struct uia_iface *uia;
uia = heap_alloc_zero(sizeof(*uia));
uia = calloc(1, sizeof(*uia));
if (!uia)
return E_OUTOFMEMORY;

View File

@ -139,7 +139,7 @@ static HRESULT uia_event_map_add_event(struct uia_event *event)
if (!(event_entry = uia_get_event_map_entry_for_event(event->event_id)))
{
if (!(event_entry = heap_alloc_zero(sizeof(*event_entry))))
if (!(event_entry = calloc(1, sizeof(*event_entry))))
{
LeaveCriticalSection(&event_map_cs);
return E_OUTOFMEMORY;
@ -207,7 +207,7 @@ static void uia_event_map_entry_release(struct uia_event_map_entry *entry)
IWineUiaEvent_Release(&event->IWineUiaEvent_iface);
}
heap_free(entry);
free(entry);
}
}
@ -219,7 +219,7 @@ static void uia_event_map_entry_release(struct uia_event_map_entry *entry)
*/
static struct uia_event_args *create_uia_event_args(const struct uia_event_info *event_info)
{
struct uia_event_args *args = heap_alloc_zero(sizeof(*args));
struct uia_event_args *args = calloc(1, sizeof(*args));
if (!args)
return NULL;
@ -234,7 +234,7 @@ static struct uia_event_args *create_uia_event_args(const struct uia_event_info
static void uia_event_args_release(struct uia_event_args *args)
{
if (!InterlockedDecrement(&args->ref))
heap_free(args);
free(args);
}
/*
@ -412,7 +412,7 @@ static void uia_event_thread_process_queue(struct list *event_queue)
uia_event_args_release(event->args);
IWineUiaEvent_Release(&event->event->IWineUiaEvent_iface);
heap_free(event);
free(event);
}
}
@ -581,8 +581,8 @@ static ULONG WINAPI uia_event_Release(IWineUiaEvent *iface)
for (i = 0; i < event->event_advisers_count; i++)
IWineUiaEventAdviser_Release(event->event_advisers[i]);
heap_free(event->event_advisers);
heap_free(event);
free(event->event_advisers);
free(event);
}
return ref;
@ -626,7 +626,7 @@ static HRESULT WINAPI uia_event_advise_events(IWineUiaEvent *iface, BOOL advise_
for (i = 0; i < event->event_advisers_count; i++)
IWineUiaEventAdviser_Release(event->event_advisers[i]);
heap_free(event->event_advisers);
free(event->event_advisers);
event->event_advisers_count = event->event_advisers_arr_size = 0;
}
@ -671,12 +671,12 @@ static HRESULT WINAPI uia_event_raise_event(IWineUiaEvent *iface, VARIANT in_nod
assert(event->event_type != EVENT_TYPE_SERVERSIDE);
if (!(queue_event = heap_alloc_zero(sizeof(*queue_event))))
if (!(queue_event = calloc(1, sizeof(*queue_event))))
return E_OUTOFMEMORY;
if (!(args = create_uia_event_args(uia_event_info_from_id(event->event_id))))
{
heap_free(queue_event);
free(queue_event);
return E_OUTOFMEMORY;
}
@ -712,7 +712,7 @@ static struct uia_event *unsafe_impl_from_IWineUiaEvent(IWineUiaEvent *iface)
static HRESULT create_uia_event(struct uia_event **out_event, LONG event_cookie, int event_type)
{
struct uia_event *event = heap_alloc_zero(sizeof(*event));
struct uia_event *event = calloc(1, sizeof(*event));
*out_event = NULL;
if (!event)
@ -775,7 +775,7 @@ HRESULT create_serverside_uia_event(struct uia_event **out_event, LONG process_i
if (!uia_start_event_thread())
{
heap_free(event);
free(event);
hr = E_FAIL;
goto exit;
}
@ -856,7 +856,7 @@ static ULONG WINAPI uia_event_adviser_Release(IWineUiaEventAdviser *iface)
WARN("Failed to revoke advise events interface from GIT\n");
}
IRawElementProviderAdviseEvents_Release(adv_events->advise_events);
heap_free(adv_events);
free(adv_events);
}
return ref;
@ -920,7 +920,7 @@ HRESULT uia_event_add_provider_event_adviser(IRawElementProviderAdviseEvents *ad
if (FAILED(hr))
return hr;
if (!(adv_events = heap_alloc_zero(sizeof(*adv_events))))
if (!(adv_events = calloc(1, sizeof(*adv_events))))
return E_OUTOFMEMORY;
if (prov_opts & ProviderOptions_UseComThreading)
@ -929,7 +929,7 @@ HRESULT uia_event_add_provider_event_adviser(IRawElementProviderAdviseEvents *ad
&adv_events->git_cookie);
if (FAILED(hr))
{
heap_free(adv_events);
free(adv_events);
return hr;
}
}
@ -990,7 +990,7 @@ static ULONG WINAPI uia_serverside_event_adviser_Release(IWineUiaEventAdviser *i
if (!ref)
{
IWineUiaEvent_Release(adv_events->event_iface);
heap_free(adv_events);
free(adv_events);
}
return ref;
}
@ -1057,7 +1057,7 @@ HRESULT uia_event_add_serverside_event_adviser(IWineUiaEvent *serverside_event,
}
}
if (!(adv_events = heap_alloc_zero(sizeof(*adv_events))))
if (!(adv_events = calloc(1, sizeof(*adv_events))))
return E_OUTOFMEMORY;
adv_events->IWineUiaEventAdviser_iface.lpVtbl = &uia_serverside_event_adviser_vtbl;
@ -1280,14 +1280,14 @@ static HRESULT uia_event_invoke(HUIANODE node, HUIANODE nav_start_node, struct u
struct uia_queue_event *queue_event;
HUIANODE node2, nav_start_node2;
if (!(queue_event = heap_alloc_zero(sizeof(*queue_event))))
if (!(queue_event = calloc(1, sizeof(*queue_event))))
return E_OUTOFMEMORY;
node2 = nav_start_node2 = NULL;
hr = clone_uia_node(node, &node2);
if (FAILED(hr))
{
heap_free(queue_event);
free(queue_event);
return hr;
}
@ -1296,7 +1296,7 @@ static HRESULT uia_event_invoke(HUIANODE node, HUIANODE nav_start_node, struct u
hr = clone_uia_node(nav_start_node, &nav_start_node2);
if (FAILED(hr))
{
heap_free(queue_event);
free(queue_event);
UiaNodeRelease(node2);
return hr;
}

View File

@ -68,7 +68,7 @@ static ULONG WINAPI uia_object_wrapper_Release(IUnknown *iface)
if (!refcount)
{
IUnknown_Release(wrapper->marshaler);
heap_free(wrapper);
free(wrapper);
}
return refcount;
@ -92,7 +92,7 @@ static HRESULT create_uia_object_wrapper(IUnknown *reserved, void **ppv)
TRACE("%p, %p\n", reserved, ppv);
wrapper = heap_alloc(sizeof(*wrapper));
wrapper = calloc(1, sizeof(*wrapper));
if (!wrapper)
return E_OUTOFMEMORY;
@ -102,7 +102,7 @@ static HRESULT create_uia_object_wrapper(IUnknown *reserved, void **ppv)
if (FAILED(hr = CoCreateFreeThreadedMarshaler(&wrapper->IUnknown_iface, &wrapper->marshaler)))
{
heap_free(wrapper);
free(wrapper);
return hr;
}
@ -193,7 +193,7 @@ ULONG WINAPI hwnd_host_provider_Release(IRawElementProviderSimple *iface)
TRACE("%p, refcount %ld\n", iface, refcount);
if (!refcount)
heap_free(host_prov);
free(host_prov);
return refcount;
}
@ -370,7 +370,7 @@ HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **pr
if (!IsWindow(hwnd) || !provider)
return E_INVALIDARG;
host_prov = heap_alloc(sizeof(*host_prov));
host_prov = calloc(1, sizeof(*host_prov));
if (!host_prov)
return E_OUTOFMEMORY;
@ -446,7 +446,7 @@ static ULONG WINAPI uia_cf_Release(IClassFactory *iface)
TRACE("%p, refcount %ld\n", cf, ref);
if (!ref)
heap_free(cf);
free(cf);
return ref;
}
@ -496,7 +496,7 @@ static const IClassFactoryVtbl uia_cf_Vtbl =
static inline HRESULT create_uia_cf(REFCLSID clsid, REFIID riid, void **ppv)
{
struct uia_cf *cf = heap_alloc_zero(sizeof(*cf));
struct uia_cf *cf = calloc(1, sizeof(*cf));
HRESULT hr;
*ppv = NULL;

View File

@ -22,7 +22,6 @@
#include "uia_classes.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "wine/heap.h"
extern HMODULE huia_module DECLSPEC_HIDDEN;
@ -187,10 +186,7 @@ static inline BOOL uia_array_reserve(void **elements, SIZE_T *capacity, SIZE_T c
if (new_capacity < count)
new_capacity = count;
if (!*elements)
new_elements = heap_alloc_zero(new_capacity * size);
else
new_elements = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *elements, new_capacity * size);
new_elements = _recalloc(*elements, new_capacity, size);
if (!new_elements)
return FALSE;

View File

@ -342,7 +342,7 @@ static HRESULT msaa_acc_get_child_pos(IAccessible *acc, IAccessible **out_parent
return hr;
}
children = heap_alloc_zero(sizeof(*children) * child_count);
children = calloc(child_count, sizeof(*children));
if (!children)
return E_OUTOFMEMORY;
@ -396,7 +396,7 @@ exit:
IAccessible_Release(children[i]);
}
heap_free(children);
free(children);
return hr;
}
@ -572,7 +572,7 @@ ULONG WINAPI msaa_provider_Release(IRawElementProviderSimple *iface)
IAccessible_Release(msaa_prov->parent);
if (msaa_prov->ia2)
IAccessible2_Release(msaa_prov->ia2);
heap_free(msaa_prov);
free(msaa_prov);
}
return refcount;
@ -1136,7 +1136,7 @@ static const ILegacyIAccessibleProviderVtbl msaa_acc_provider_vtbl = {
HRESULT create_msaa_provider(IAccessible *acc, LONG child_id, HWND hwnd, BOOL known_root_acc,
IRawElementProviderSimple **elprov)
{
struct msaa_provider *msaa_prov = heap_alloc_zero(sizeof(*msaa_prov));
struct msaa_provider *msaa_prov = calloc(1, sizeof(*msaa_prov));
if (!msaa_prov)
return E_OUTOFMEMORY;
@ -1337,7 +1337,7 @@ static ULONG WINAPI base_hwnd_provider_Release(IRawElementProviderSimple *iface)
TRACE("%p, refcount %ld\n", iface, refcount);
if (!refcount)
heap_free(base_hwnd_prov);
free(base_hwnd_prov);
return refcount;
}
@ -1629,7 +1629,7 @@ HRESULT create_base_hwnd_provider(HWND hwnd, IRawElementProviderSimple **elprov)
if (!IsWindow(hwnd))
return UIA_E_ELEMENTNOTAVAILABLE;
if (!(base_hwnd_prov = heap_alloc_zero(sizeof(*base_hwnd_prov))))
if (!(base_hwnd_prov = calloc(1, sizeof(*base_hwnd_prov))))
return E_OUTOFMEMORY;
base_hwnd_prov->IRawElementProviderSimple_iface.lpVtbl = &base_hwnd_provider_vtbl;
@ -1695,7 +1695,7 @@ void uia_provider_thread_remove_node(HUIANODE node)
{
rb_remove(&provider_thread.node_map, &node_data->map->entry);
SafeArrayDestroy(node_data->map->runtime_id);
heap_free(node_data->map);
free(node_data->map);
}
node_data->map = NULL;
}
@ -1736,7 +1736,7 @@ static void uia_provider_thread_disconnect_node(SAFEARRAY *sa)
rb_remove(&provider_thread.node_map, &prov_map->entry);
SafeArrayDestroy(prov_map->runtime_id);
heap_free(prov_map);
free(prov_map);
}
exit:
@ -1768,7 +1768,7 @@ static HRESULT uia_provider_thread_add_node(HUIANODE node, SAFEARRAY *rt_id)
prov_map = RB_ENTRY_VALUE(rb_entry, struct uia_provider_thread_map_entry, entry);
else
{
prov_map = heap_alloc_zero(sizeof(*prov_map));
prov_map = calloc(1, sizeof(*prov_map));
if (!prov_map)
{
hr = E_OUTOFMEMORY;
@ -1778,7 +1778,7 @@ static HRESULT uia_provider_thread_add_node(HUIANODE node, SAFEARRAY *rt_id)
hr = SafeArrayCopy(rt_id, &prov_map->runtime_id);
if (FAILED(hr))
{
heap_free(prov_map);
free(prov_map);
goto exit;
}
list_init(&prov_map->nodes_list);

View File

@ -149,7 +149,7 @@ static void uia_condition_destroy(struct UiaCondition *cond)
for (i = 0; i < and_or_cond->cConditions; i++)
uia_condition_destroy(and_or_cond->ppConditions[i]);
heap_free(and_or_cond->ppConditions);
free(and_or_cond->ppConditions);
break;
}
@ -157,7 +157,7 @@ static void uia_condition_destroy(struct UiaCondition *cond)
break;
}
heap_free(cond);
free(cond);
}
static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaCondition *src)
@ -169,7 +169,7 @@ static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaConditio
{
case ConditionType_True:
case ConditionType_False:
if (!(*dst = heap_alloc_zero(sizeof(**dst))))
if (!(*dst = calloc(1, sizeof(**dst))))
return E_OUTOFMEMORY;
(*dst)->ConditionType = src->ConditionType;
@ -177,7 +177,7 @@ static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaConditio
case ConditionType_Property:
{
struct UiaPropertyCondition *prop_cond = heap_alloc_zero(sizeof(*prop_cond));
struct UiaPropertyCondition *prop_cond = calloc(1, sizeof(*prop_cond));
struct UiaPropertyCondition *src_cond = (struct UiaPropertyCondition *)src;
if (!prop_cond)
@ -194,7 +194,7 @@ static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaConditio
case ConditionType_Not:
{
struct UiaNotCondition *not_cond = heap_alloc_zero(sizeof(*not_cond));
struct UiaNotCondition *not_cond = calloc(1, sizeof(*not_cond));
struct UiaNotCondition *src_cond = (struct UiaNotCondition *)src;
if (!not_cond)
@ -209,7 +209,7 @@ static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaConditio
case ConditionType_And:
case ConditionType_Or:
{
struct UiaAndOrCondition *and_or_cond = heap_alloc_zero(sizeof(*and_or_cond));
struct UiaAndOrCondition *and_or_cond = calloc(1, sizeof(*and_or_cond));
struct UiaAndOrCondition *src_cond = (struct UiaAndOrCondition *)src;
int i;
@ -218,7 +218,7 @@ static HRESULT uia_condition_clone(struct UiaCondition **dst, struct UiaConditio
*dst = (struct UiaCondition *)and_or_cond;
and_or_cond->ConditionType = src_cond->ConditionType;
and_or_cond->ppConditions = heap_alloc_zero(sizeof(*and_or_cond->ppConditions) * src_cond->cConditions);
and_or_cond->ppConditions = calloc(src_cond->cConditions, sizeof(*and_or_cond->ppConditions));
if (!and_or_cond->ppConditions)
{
hr = E_OUTOFMEMORY;
@ -257,8 +257,8 @@ exit:
void uia_cache_request_destroy(struct UiaCacheRequest *cache_req)
{
uia_condition_destroy(cache_req->pViewCondition);
heap_free(cache_req->pProperties);
heap_free(cache_req->pPatterns);
free(cache_req->pProperties);
free(cache_req->pPatterns);
}
HRESULT uia_cache_request_clone(struct UiaCacheRequest *dst, struct UiaCacheRequest *src)
@ -273,7 +273,7 @@ HRESULT uia_cache_request_clone(struct UiaCacheRequest *dst, struct UiaCacheRequ
dst->automationElementMode = src->automationElementMode;
if (src->cProperties)
{
if (!(dst->pProperties = heap_alloc_zero(sizeof(*dst->pProperties) * src->cProperties)))
if (!(dst->pProperties = calloc(src->cProperties, sizeof(*dst->pProperties))))
{
uia_cache_request_destroy(dst);
return E_OUTOFMEMORY;
@ -285,7 +285,7 @@ HRESULT uia_cache_request_clone(struct UiaCacheRequest *dst, struct UiaCacheRequ
if (src->cPatterns)
{
if (!(dst->pPatterns = heap_alloc_zero(sizeof(*dst->pPatterns) * src->cPatterns)))
if (!(dst->pPatterns = calloc(src->cPatterns, sizeof(*dst->pPatterns))))
{
uia_cache_request_destroy(dst);
return E_OUTOFMEMORY;