From 51c3203e492132728001cc6486075ef470d4edbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 14 Mar 2014 17:07:44 +0100 Subject: [PATCH] wined3d: Free old data after addrefing the new one. --- 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 74ff3d1b926..7bb37d68ee5 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;