[PATCH 3/7] ole32: Add the ability to create an entry without returning it.

Huw Davies huw at codeweavers.com
Tue Jun 6 05:46:50 CDT 2017


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/ole32/datacache.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 3f91355506..eca2d95f90 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -363,6 +363,7 @@ static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc
                                      DataCacheEntry **cache_entry)
 {
     HRESULT hr;
+    DataCacheEntry *entry;
 
     hr = check_valid_clipformat_and_tymed(formatetc->cfFormat, formatetc->tymed);
     if (FAILED(hr))
@@ -370,20 +371,21 @@ static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc
     if (hr == CACHE_S_FORMATETC_NOTSUPPORTED)
         TRACE("creating unsupported format %d\n", formatetc->cfFormat);
 
-    *cache_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(**cache_entry));
-    if (!*cache_entry)
+    entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
+    if (!entry)
         return E_OUTOFMEMORY;
 
-    if (!init_cache_entry(*cache_entry, formatetc, advf, This->last_cache_id))
+    if (!init_cache_entry(entry, formatetc, advf, This->last_cache_id))
         goto fail;
 
-    list_add_tail(&This->cache_list, &(*cache_entry)->entry);
+    list_add_tail(&This->cache_list, &entry->entry);
     This->last_cache_id++;
 
+    if (cache_entry) *cache_entry = entry;
     return hr;
 
 fail:
-    HeapFree(GetProcessHeap(), 0, *cache_entry);
+    HeapFree(GetProcessHeap(), 0, entry);
     return E_OUTOFMEMORY;
 }
 
-- 
2.12.0




More information about the wine-patches mailing list