[PATCH] wined3d: Free old data after addrefing the new one.
Stefan Dösinger
stefan at codeweavers.com
Fri Mar 14 11:07:44 CDT 2014
I don't know if there's any application that needs this. It just seems
like a good thing to do.
This applies on top of 103222.
---
include/wine/wined3d.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 74ff3d1..7bb37d6 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2323,9 +2323,6 @@ static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_priv
if (!(d = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(struct wined3d_private_data, content.data[data_size]))))
return E_OUTOFMEMORY;
- old = wined3d_private_store_get_private_data(store, guid);
- if (old)
- wined3d_private_store_free_private_data(store, old);
d->tag = *guid;
d->flags = flags;
@@ -2334,6 +2331,10 @@ static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_priv
memcpy(d->content.data, ptr, data_size);
if (flags & WINED3DSPD_IUNKNOWN)
IUnknown_AddRef(d->content.object);
+
+ old = wined3d_private_store_get_private_data(store, guid);
+ if (old)
+ wined3d_private_store_free_private_data(store, old);
list_add_tail(&store->content, &d->entry);
return WINED3D_OK;
--
1.8.3.2
More information about the wine-patches
mailing list