On Mon Sep 18 11:51:10 2023 +0000, Nikolay Sivov wrote:
Do we need memset()? nSinks here is actual count, and maxSinks is allocated limit. So ConnectionPointImpl_Destroy() should probably use nSinks too, and not maxSinks. Same for Unadvise().
I'm pretty sure the original code was right to zero out the new array elements. Looking at the implementation of ConnectionPointImpl_Unadvise, it seems This->sinks is not always a contiguous array. A sink can be removed from the middle of the array and replaced with NULL, and nSinks is still decreased by 1. After such a removal, there would be an item in the array whose index is greater than or equal to nSinks, and it would still need to be freed in ConnectionPointImpl_Destroy.