Rémi Bernon (@rbernon) commented about dlls/dmime/audiopath.c:
if (bytes % sizeof(GUID))
{
WARN("Invalid size of GUIDs array\n");
hr = E_FAIL;
goto done;
}
pchannel_to_buffer->num_of_guids = bytes / sizeof(GUID);
pchannel_to_buffer->guids = calloc(pchannel_to_buffer->num_of_guids, sizeof(GUID));
TRACE("number of GUIDs: %lu\n", pchannel_to_buffer->num_of_guids);
if (!pchannel_to_buffer->guids)
{
hr = E_OUTOFMEMORY;
goto done;
}
Imo a flexible guids array member would make the logic simpler and let you have a single alloc here.