Skip to content

Review error handling paths in register_callback for Windows backend #785

@Youw

Description

@Youw

On the error returns in the first-callback path (e.g., notify_handle != NULL or CM_Register_Notification(...) != CR_SUCCESS), the newly allocated hotplug_cb (and the devs list from hid_enumerate) are not freed, and hid_hotplug_context.hotplug_cbs may already be set to hotplug_cb. This leaves the hotplug context in a partially-initialized state and leaks memory; the error path should undo any state changes and free allocations before returning.

Originally posted by @Copilot in #674 (comment)
Also: #674 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions