Vibhav Pant (@vibhavp) commented about dlls/ntoskrnl.exe/pnp.c:
- WCHAR *id; + + device_instance_id = HeapAlloc( GetProcessHeap(), 0, MAX_DEVICE_ID_LEN * sizeof(WCHAR) ); + if (!device_instance_id) + { + ERR("Failed to allocate memory for device instance ID\n"); + return; + }
if (get_device_instance_id( device, device_instance_id )) + { + HeapFree( GetProcessHeap(), 0, device_instance_id ); return; + } + + CONTAINING_RECORD(device, struct wine_device, device_obj)->instance_id = device_instance_id; <span dir="">This could also be accomplished by letting `device_instance_id` be a stack-allocated array, and using `wcsdup`</span>. That way we're not unnecessarily allocating 400 bytes for every device object.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8015#note_109757