Michael Stefaniuc : ole32: Allocate a small temp variable on the stack instead of the heap.

Alexandre Julliard julliard at winehq.org
Wed Sep 29 12:00:14 CDT 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Tue Sep 28 22:43:50 2010 +0200

ole32: Allocate a small temp variable on the stack instead of the heap.

---

 dlls/ole32/ole2.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 2b301e4..0829ca1 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -2530,19 +2530,17 @@ HRESULT WINAPI OleCreate(
             if (SUCCEEDED(hres2))
             {
                 DWORD dwConnection;
-                FORMATETC *pfe;
                 if (renderopt == OLERENDER_DRAW && !pFormatEtc) {
-                    pfe = HeapAlloc(GetProcessHeap(), 0, sizeof(FORMATETC));
-                    pfe->cfFormat = 0;
-                    pfe->ptd = NULL;
-                    pfe->dwAspect = DVASPECT_CONTENT;
-                    pfe->lindex = -1;
-                    pfe->tymed = TYMED_NULL;
-                }else
-                    pfe = pFormatEtc;
-                hres = IOleCache_Cache(pOleCache, pfe, ADVF_PRIMEFIRST, &dwConnection);
-                if (!pFormatEtc && pfe)
-                    HeapFree(GetProcessHeap(), 0, pfe);
+                    FORMATETC pfe;
+                    pfe.cfFormat = 0;
+                    pfe.ptd = NULL;
+                    pfe.dwAspect = DVASPECT_CONTENT;
+                    pfe.lindex = -1;
+                    pfe.tymed = TYMED_NULL;
+                    hres = IOleCache_Cache(pOleCache, &pfe, ADVF_PRIMEFIRST, &dwConnection);
+                }
+                else
+                    hres = IOleCache_Cache(pOleCache, pFormatEtc, ADVF_PRIMEFIRST, &dwConnection);
                 IOleCache_Release(pOleCache);
             }
         }




More information about the wine-cvs mailing list