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 455027 db9096e8e9bdf717d37a86339a363d6de45530f1
parent 455026 0e8105f2fe557587d5010f611ae10471836f219c
child 455028 ddc8ae7f629ebfdc46b1037debedbd8803938950
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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)