Freeing Resources

User-mode applications and kernel-mode drivers that are HID clients should always free any resources that are no longer required.

For example, a user-mode application must call SetupDiDestroyDeviceInfoList with the handle to the device list that it obtained from SetupDiGetClassDevs after completing its initialization and connection operations for a HIDClass device. Failure to call SetupDiDestroyDeviceInfoList causes a memory leak.