Bug 1440564: mscom::StructToStream: Free the buffer when destroying the instance. r=aklotz a=liizard DEVEDITION_59_0b13_BUILD1 DEVEDITION_59_0b13_RELEASE FENNEC_59_0b13_BUILD1 FENNEC_59_0b13_RELEASE FIREFOX_59_0b13_BUILD1 FIREFOX_59_0b13_RELEASE
authorJames Teh <jteh@mozilla.com>
Fri, 23 Feb 2018 20:00:30 +1000
changeset 761697 db9096e8e9bdf717d37a86339a363d6de45530f1
parent 761696 0e8105f2fe557587d5010f611ae10471836f219c
child 761698 ddc8ae7f629ebfdc46b1037debedbd8803938950
push id100982
push userstransky@redhat.com
push dateThu, 01 Mar 2018 09:41:46 +0000
reviewersaklotz, liizard
bugs1440564
milestone59.0
Bug 1440564: mscom::StructToStream: Free the buffer when destroying the instance. r=aklotz a=liizard 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
ipc/mscom/StructStream.h
--- 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)