From: Alex Henrie alexhenrie24@gmail.com
--- dlls/ole32/compositemoniker.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 84099cee6d6..3d40cc337f3 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -751,7 +751,11 @@ static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker *iface, IMo heap_free(components); heap_free(other_components);
- if (!prefix_len) return MK_E_NOPREFIX; + if (!prefix_len) + { + heap_free(prefix_components); + return MK_E_NOPREFIX; + }
last = prefix_components[0]; for (i = 1; i < prefix_len; ++i)
This merge request was approved by Nikolay Sivov.
In addition to the leak you've fixed, I think there is more. I haven't checked Coverity reports for this one, please take a look to see if you can spot any issues with it. I'll submit it separately, your change is not affected by it.
[0001-ole32-compositemoniker-Fix-a-possible-leak-of-moniker-.txt](/uploads/dc70c9bbc0ce4ca6f9b584fbe1a29389/0001-ole32-compositemoniker-Fix-a-possible-leak-of-moniker-.txt)
On Wed Nov 16 05:26:40 2022 +0000, Nikolay Sivov wrote:
In addition to the leak you've fixed, I think there is more. I haven't checked Coverity reports for this one, please take a look to see if you can spot any issues with it. I'll submit it separately, your change is not affected by it. [0001-ole32-compositemoniker-Fix-a-possible-leak-of-moniker-.txt](/uploads/dc70c9bbc0ce4ca6f9b584fbe1a29389/0001-ole32-compositemoniker-Fix-a-possible-leak-of-moniker-.txt)
composite_get_(left|right)most also leak on error, but I'm waiting until !1375 is merged to fix them.
Coverity does not report any other memory leaks in CompositeMonikerImpl_CommonPrefixWith, but that just means that you are sharper than Coverity ;-) The patch that you attached definitely fixes another leak and a double free too.
composite_get_(left|right)most also leak on error, but I'm waiting until !1375 is merged to fix them.
I see, at least tree_release() is missing in a couple of places.