Michael Stefaniuc : itss: Don' t over-allocate memory for a ITSS_IStorageImpl.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 14:00:38 CST 2012


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Dec 10 10:31:41 2012 +0100

itss: Don't over-allocate memory for a ITSS_IStorageImpl.

---

 dlls/itss/storage.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/itss/storage.c b/dlls/itss/storage.c
index c53b0c2..60e452d 100644
--- a/dlls/itss/storage.c
+++ b/dlls/itss/storage.c
@@ -616,13 +616,11 @@ static HRESULT ITSS_create_chm_storage(
       struct chmFile *chmfile, const WCHAR *dir, IStorage** ppstgOpen )
 {
     ITSS_IStorageImpl *stg;
-    DWORD len;
 
     TRACE("%p %s\n", chmfile, debugstr_w( dir ) );
 
-    len = strlenW( dir ) + 1;
-    stg = HeapAlloc( GetProcessHeap(), 0, 
-                     sizeof (ITSS_IStorageImpl) + len*sizeof(WCHAR) );
+    stg = HeapAlloc( GetProcessHeap(), 0,
+                     FIELD_OFFSET( ITSS_IStorageImpl, dir[strlenW( dir ) + 1] ));
     stg->IStorage_iface.lpVtbl = &ITSS_IStorageImpl_Vtbl;
     stg->ref = 1;
     stg->chmfile = chmfile;




More information about the wine-cvs mailing list