Jacek Caban : mshtml: Fixed a leak (valgrind).
Alexandre Julliard
julliard at winehq.org
Tue Feb 15 11:29:29 CST 2011
Module: wine
Branch: master
Commit: 8b861189e987ec511bb58c4213ebb23e23b54073
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b861189e987ec511bb58c4213ebb23e23b54073
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Feb 15 17:33:27 2011 +0100
mshtml: Fixed a leak (valgrind).
---
dlls/mshtml/protocol.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index 58f4dee..dad93ba 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -217,6 +217,8 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
BINDINFO bindinfo;
DWORD grfBINDF = 0;
LPCWSTR text = NULL;
+ DWORD data_len;
+ BYTE *data;
static const WCHAR html_begin[] = {0xfeff,'<','H','T','M','L','>',0};
static const WCHAR html_end[] = {'<','/','H','T','M','L','>',0};
@@ -247,9 +249,15 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
text = NULL;
}
- This->data_len = sizeof(html_begin)+sizeof(html_end)-sizeof(WCHAR)
+ data_len = sizeof(html_begin)+sizeof(html_end)-sizeof(WCHAR)
+ (text ? strlenW(text)*sizeof(WCHAR) : 0);
- This->data = heap_alloc(This->data_len);
+ data = heap_alloc(data_len);
+ if(!data)
+ return E_OUTOFMEMORY;
+
+ heap_free(This->data);
+ This->data = data;
+ This->data_len = data_len;
memcpy(This->data, html_begin, sizeof(html_begin));
if(text)
More information about the wine-cvs
mailing list