Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_event.c:
assert(!event->event_map_entry); SafeArrayDestroy(event->runtime_id);
uia_cache_request_destroy(&event->cache_req);
if (event->event_type == EVENT_TYPE_CLIENTSIDE){uia_cache_request_destroy(&event->u.clientside.cache_req);if (event->u.clientside.mta_cookie)CoDecrementMTAUsage(event->u.clientside.mta_cookie);}elseIWineUiaNode_Release(event->u.serverside.node);
Is this going to work if uia_node_attach_event takes an error path and doesn't set this?