Rémi Bernon (@rbernon) commented about dlls/windows.devices.enumeration/main.c:
if (dup)
{
hr = IIterator_HSTRING_MoveNext( names, &valid );
continue;
}
if (!(tmp = realloc( *keys, sizeof( **keys ) * (*keys_len + 1) )))
{
hr = E_OUTOFMEMORY;
break;
}
*keys = tmp;
tmp = &(*keys)[*keys_len];
*keys_len += 1;
tmp->Key = key;
tmp->Store = DEVPROP_STORE_SYSTEM;
tmp->LocaleName = NULL;
It's usually not a good idea to increment realloc size by 1, you should rather count the max number of additional properties and allocate a large enough array upfront. It's fine to overallocate if there's duplicate entries.