Elizabeth Figura (@zfigura) commented about dlls/bluetoothapis/main.c:
- Sleep( params->cTimeoutMultiplier * 1280 );
- radio_set_inquiry( params->hRadio, FALSE );
- success = radio_get_devices( params->hRadio, &device_list );
- if (!success)
return NULL;
- hfind = malloc( sizeof( *hfind ) );
- if (!hfind)
- {
free( device_list );
SetLastError( ERROR_OUTOFMEMORY );
return NULL;
- }
- memcpy( hfind, params, sizeof( *params ) );
Don't memcpy between two structures of different types when you can memcpy to the member ("&hfind->params"), that's unnecessarily fragile and opaque. Better yet, don't memcpy at all but just perform a structure assignment.