Rob Shearman : ole32: Fix memory leaks caused by not calling the channel hook function when extension_size is zero .

Alexandre Julliard julliard at winehq.org
Mon Jan 7 16:25:00 CST 2008


Module: wine
Branch: master
Commit: f2b1a1106b04948c4e8a3409585138c3af4a49ee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f2b1a1106b04948c4e8a3409585138c3af4a49ee

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Jan  7 17:15:17 2008 +0000

ole32: Fix memory leaks caused by not calling the channel hook function when extension_size is zero.

Instead free the allocated memory outside of the channel hook function.

---

 dlls/ole32/rpc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index ad6a39f..31b9eb1 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -248,8 +248,6 @@ static unsigned char * ChannelHooks_ClientFillBuffer(SChannelHookCallInfo *info,
 
     LeaveCriticalSection(&csChannelHook);
 
-    HeapFree(GetProcessHeap(), 0, data);
-
     return buffer;
 }
 
@@ -370,8 +368,6 @@ static unsigned char * ChannelHooks_ServerFillBuffer(SChannelHookCallInfo *info,
 
     LeaveCriticalSection(&csChannelHook);
 
-    HeapFree(GetProcessHeap(), 0, data);
-
     return buffer;
 }
 
@@ -563,6 +559,8 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
         }
     }
 
+    HeapFree(GetProcessHeap(), 0, channel_hook_data);
+
     /* store the prefixed data length so that we can restore the real buffer
      * later */
     message_state->prefix_data_len = (char *)msg->Buffer - (char *)orpcthat;
@@ -751,6 +749,8 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
         msg->BufferLength -= message_state->prefix_data_len;
     }
 
+    HeapFree(GetProcessHeap(), 0, channel_hook_data);
+
     TRACE("-- %ld\n", status);
 
     return HRESULT_FROM_WIN32(status);




More information about the wine-cvs mailing list