ole32: Free memory on error path (found by Smatch).
Michael Stefaniuc
mstefani at redhat.de
Mon Sep 24 18:15:07 CDT 2007
CreateStreamOnHGlobal() will "export" the HGLOBAL passed to it but not
if it fails.
---
dlls/ole32/oleproxy.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c
index e807941..42dc8d1 100644
--- a/dlls/ole32/oleproxy.c
+++ b/dlls/ole32/oleproxy.c
@@ -402,9 +402,10 @@ static HRESULT WINAPI CFProxy_CreateInstance(
hGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_NODISCARD|GMEM_SHARE,msg.cbBuffer);
memcpy(GlobalLock(hGlobal),msg.Buffer,msg.cbBuffer);
hres = CreateStreamOnHGlobal(hGlobal,TRUE,&pStream);
- if (hres) {
+ if (hres != S_OK) {
FIXME("CreateStreamOnHGlobal failed with %x\n",hres);
IRpcChannelBuffer_FreeBuffer(This->chanbuf,&msg);
+ GlobalFree(hGlobal);
return hres;
}
hres = IStream_Read(pStream, ppv, sizeof(*ppv), NULL);
--
1.5.3.2
--
Michael Stefaniuc Tel.: +49-711-96437-199
Sr. Network Engineer Fax.: +49-711-96437-111
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070925/8aa538cb/attachment.pgp
More information about the wine-patches
mailing list