Bug 1440564: mscom::StructToStream: Free the buffer when destroying the instance. r?aklotz
You'd think that MesHandleFree would free the buffer, since it was created by RPC, but it doesn't.
Therefore, we must free it ourselves using midl_user_free.
MozReview-Commit-ID: 9KzWTngFEEq
--- a/ipc/mscom/StructStream.h
+++ b/ipc/mscom/StructStream.h
@@ -71,16 +71,21 @@ public:
}
}
~StructToStream()
{
if (mHandle) {
::MesHandleFree(mHandle);
}
+ if (mBuffer) {
+ // Bug 1440564: You'd think that MesHandleFree would free the buffer,
+ // since it was created by RPC, but it doesn't.
+ midl_user_free(mBuffer);
+ }
}
static unsigned long GetEmptySize()
{
return sizeof(detail::EncodedLenT);
}
static HRESULT WriteEmpty(IStream* aDestStream)