Module: wine Branch: master Commit: 5771ff8912506d5f998d181a23ee4d382f00cfcf URL: http://source.winehq.org/git/wine.git/?a=commit;h=5771ff8912506d5f998d181a23...
Author: Michael Stefaniuc mstefani@redhat.de Date: Sun Jan 5 23:43:00 2014 +0100
dmusic: Don't leak mem if DirectMusicCollection creation fails.
---
dlls/dmusic/collection.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index a673390..cbcc082 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -805,6 +805,7 @@ static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = { HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { IDirectMusicCollectionImpl* obj; + HRESULT hr;
*ppobj = NULL; if (pUnkOuter) @@ -821,8 +822,11 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* p DM_STRUCT_INIT(obj->pDesc); obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->guidClass = CLSID_DirectMusicCollection; - obj->ref = 0; /* will be inited by QueryInterface */ + obj->ref = 1; list_init (&obj->Instruments);
- return IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); + hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); + IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface); + + return hr; }