Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9d390da9
Commit
9d390da9
authored
Sep 10, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmband: Avoid leaking collection on band release.
parent
7fb9afea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
band.c
dlls/dmband/band.c
+32
-8
dmband_private.h
dlls/dmband/dmband_private.h
+0
-6
No files found.
dlls/dmband/band.c
View file @
9d390da9
...
...
@@ -23,12 +23,25 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmband
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
struct
instrument_entry
{
struct
list
entry
;
DMUS_IO_INSTRUMENT
instrument
;
IDirectMusicCollection
*
collection
;
};
static
void
instrument_entry_destroy
(
struct
instrument_entry
*
entry
)
{
if
(
entry
->
collection
)
IDirectMusicCollection_Release
(
entry
->
collection
);
free
(
entry
);
}
struct
band
{
IDirectMusicBand
IDirectMusicBand_iface
;
struct
dmobject
dmobj
;
LONG
ref
;
struct
list
I
nstruments
;
struct
list
i
nstruments
;
};
static
inline
struct
band
*
impl_from_IDirectMusicBand
(
IDirectMusicBand
*
iface
)
...
...
@@ -77,7 +90,18 @@ static ULONG WINAPI band_Release(IDirectMusicBand *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
free
(
This
);
if
(
!
ref
)
{
struct
instrument_entry
*
entry
,
*
next
;
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
next
,
&
This
->
instruments
,
struct
instrument_entry
,
entry
)
{
list_remove
(
&
entry
->
entry
);
instrument_entry_destroy
(
entry
);
}
free
(
This
);
}
return
ref
;
}
...
...
@@ -192,7 +216,7 @@ static HRESULT parse_instrument(struct band *This, DMUS_PRIVATE_CHUNK *pChunk,
HRESULT
hr
;
DMUS_IO_INSTRUMENT
inst
;
LPDMUS_PRIVATE_INSTRUMENT
pNewInstrument
;
struct
instrument_entry
*
pNewInstrument
;
IDirectMusicObject
*
pObject
=
NULL
;
if
(
pChunk
->
fccID
!=
DMUS_FOURCC_INSTRUMENT_LIST
)
{
...
...
@@ -272,8 +296,8 @@ static HRESULT parse_instrument(struct band *This, DMUS_PRIVATE_CHUNK *pChunk,
* @TODO insert pNewInstrument into This
*/
if
(
!
(
pNewInstrument
=
calloc
(
1
,
sizeof
(
*
pNewInstrument
))))
return
E_OUTOFMEMORY
;
memcpy
(
&
pNewInstrument
->
pI
nstrument
,
&
inst
,
sizeof
(
DMUS_IO_INSTRUMENT
));
pNewInstrument
->
ppReferenceC
ollection
=
NULL
;
memcpy
(
&
pNewInstrument
->
i
nstrument
,
&
inst
,
sizeof
(
DMUS_IO_INSTRUMENT
));
pNewInstrument
->
c
ollection
=
NULL
;
if
(
NULL
!=
pObject
)
{
IDirectMusicCollection
*
pCol
=
NULL
;
hr
=
IDirectMusicObject_QueryInterface
(
pObject
,
&
IID_IDirectMusicCollection
,
(
void
**
)
&
pCol
);
...
...
@@ -282,10 +306,10 @@ static HRESULT parse_instrument(struct band *This, DMUS_PRIVATE_CHUNK *pChunk,
free
(
pNewInstrument
);
return
hr
;
}
pNewInstrument
->
ppReferenceC
ollection
=
pCol
;
pNewInstrument
->
c
ollection
=
pCol
;
IDirectMusicObject_Release
(
pObject
);
}
list_add_tail
(
&
This
->
I
nstruments
,
&
pNewInstrument
->
entry
);
list_add_tail
(
&
This
->
i
nstruments
,
&
pNewInstrument
->
entry
);
return
S_OK
;
}
...
...
@@ -510,7 +534,7 @@ HRESULT create_dmband(REFIID lpcGUID, void **ppobj)
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicBand
,
(
IUnknown
*
)
&
obj
->
IDirectMusicBand_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
band_object_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
band_persist_stream_vtbl
;
list_init
(
&
obj
->
I
nstruments
);
list_init
(
&
obj
->
i
nstruments
);
hr
=
IDirectMusicBand_QueryInterface
(
&
obj
->
IDirectMusicBand_iface
,
lpcGUID
,
ppobj
);
IDirectMusicBand_Release
(
&
obj
->
IDirectMusicBand_iface
);
...
...
dlls/dmband/dmband_private.h
View file @
9d390da9
...
...
@@ -61,12 +61,6 @@ typedef struct _DMUS_PRIVATE_BAND_ITEM_HEADER {
MUSIC_TIME
lBandTimePhysical
;
}
DMUS_PRIVATE_BAND_ITEM_HEADER
;
typedef
struct
_DMUS_PRIVATE_INSTRUMENT
{
struct
list
entry
;
/* for listing elements */
DMUS_IO_INSTRUMENT
pInstrument
;
IDirectMusicCollection
*
ppReferenceCollection
;
}
DMUS_PRIVATE_INSTRUMENT
,
*
LPDMUS_PRIVATE_INSTRUMENT
;
/*****************************************************************************
* Misc.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment