Robert Shearman : ole32: Free the buffer allocated in local_server_thread ( found by Smatch).

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 17 07:00:13 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 352d9e2d677af6dcabd61cb3b6256773142adc8d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=352d9e2d677af6dcabd61cb3b6256773142adc8d

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Jul 14 17:14:04 2006 +0100

ole32: Free the buffer allocated in local_server_thread (found by Smatch).

---

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

diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index cf49698..8decc2c 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -976,8 +976,6 @@ static DWORD WINAPI local_server_thread(
         hres = IStream_Stat(pStm,&ststg,0);
         if (hres) return hres;
 
-        buflen = ststg.cbSize.u.LowPart;
-        buffer = HeapAlloc(GetProcessHeap(),0,buflen);
         seekto.u.LowPart = 0;
         seekto.u.HighPart = 0;
         hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
@@ -985,14 +983,20 @@ static DWORD WINAPI local_server_thread(
             FIXME("IStream_Seek failed, %lx\n",hres);
             return hres;
         }
+
+        buflen = ststg.cbSize.u.LowPart;
+        buffer = HeapAlloc(GetProcessHeap(),0,buflen);
         
         hres = IStream_Read(pStm,buffer,buflen,&res);
         if (hres) {
             FIXME("Stream Read failed, %lx\n",hres);
+            HeapFree(GetProcessHeap(),0,buffer);
             return hres;
         }
         
         WriteFile(hPipe,buffer,buflen,&res,NULL);
+        HeapFree(GetProcessHeap(),0,buffer);
+
         FlushFileBuffers(hPipe);
         DisconnectNamedPipe(hPipe);
 




More information about the wine-cvs mailing list