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
7fb9afea
Commit
7fb9afea
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 bands on band track Release.
parent
696e8c12
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
16 deletions
+35
-16
bandtrack.c
dlls/dmband/bandtrack.c
+35
-10
dmband_private.h
dlls/dmband/dmband_private.h
+0
-6
No files found.
dlls/dmband/bandtrack.c
View file @
7fb9afea
...
...
@@ -22,13 +22,26 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmband
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
struct
band_entry
{
struct
list
entry
;
DMUS_PRIVATE_BAND_ITEM_HEADER
head
;
IDirectMusicBand
*
band
;
};
static
void
band_entry_destroy
(
struct
band_entry
*
entry
)
{
IDirectMusicTrack_Release
(
entry
->
band
);
free
(
entry
);
}
struct
band_track
{
IDirectMusicTrack8
IDirectMusicTrack8_iface
;
struct
dmobject
dmobj
;
/* IPersistStream only */
LONG
ref
;
DMUS_IO_BAND_TRACK_HEADER
header
;
struct
list
B
ands
;
struct
list
b
ands
;
};
static
inline
struct
band_track
*
impl_from_IDirectMusicTrack8
(
IDirectMusicTrack8
*
iface
)
...
...
@@ -76,7 +89,18 @@ static ULONG WINAPI band_track_Release(IDirectMusicTrack8 *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
free
(
This
);
if
(
!
ref
)
{
struct
band_entry
*
entry
,
*
next
;
LIST_FOR_EACH_ENTRY_SAFE
(
entry
,
next
,
&
This
->
bands
,
struct
band_entry
,
entry
)
{
list_remove
(
&
entry
->
entry
);
band_entry_destroy
(
entry
);
}
free
(
This
);
}
return
ref
;
}
...
...
@@ -337,13 +361,14 @@ static HRESULT load_band(struct band_track *This, IStream *pClonedStream,
/*
* @TODO insert pBand into This
*/
if
(
SUCCEEDED
(
hr
))
{
LPDMUS_PRIVATE_BAND
pNewBand
;
if
(
!
(
pNewBand
=
calloc
(
1
,
sizeof
(
*
pNewBand
))))
return
E_OUTOFMEMORY
;
pNewBand
->
BandHeader
=
*
pHeader
;
pNewBand
->
band
=
*
ppBand
;
IDirectMusicBand_AddRef
(
*
ppBand
);
list_add_tail
(
&
This
->
Bands
,
&
pNewBand
->
entry
);
if
(
SUCCEEDED
(
hr
))
{
struct
band_entry
*
entry
;
if
(
!
(
entry
=
calloc
(
1
,
sizeof
(
*
entry
))))
return
E_OUTOFMEMORY
;
entry
->
head
=
*
pHeader
;
entry
->
band
=
*
ppBand
;
IDirectMusicBand_AddRef
(
*
ppBand
);
list_add_tail
(
&
This
->
bands
,
&
entry
->
entry
);
}
return
S_OK
;
...
...
@@ -635,7 +660,7 @@ HRESULT create_dmbandtrack(REFIID lpcGUID, void **ppobj)
track
->
ref
=
1
;
dmobject_init
(
&
track
->
dmobj
,
&
CLSID_DirectMusicBandTrack
,
(
IUnknown
*
)
&
track
->
IDirectMusicTrack8_iface
);
track
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
band_track_persist_stream_vtbl
;
list_init
(
&
track
->
B
ands
);
list_init
(
&
track
->
b
ands
);
hr
=
IDirectMusicTrack8_QueryInterface
(
&
track
->
IDirectMusicTrack8_iface
,
lpcGUID
,
ppobj
);
IDirectMusicTrack8_Release
(
&
track
->
IDirectMusicTrack8_iface
);
...
...
dlls/dmband/dmband_private.h
View file @
7fb9afea
...
...
@@ -67,12 +67,6 @@ typedef struct _DMUS_PRIVATE_INSTRUMENT {
IDirectMusicCollection
*
ppReferenceCollection
;
}
DMUS_PRIVATE_INSTRUMENT
,
*
LPDMUS_PRIVATE_INSTRUMENT
;
typedef
struct
_DMUS_PRIVATE_BAND
{
struct
list
entry
;
/* for listing elements */
DMUS_PRIVATE_BAND_ITEM_HEADER
BandHeader
;
IDirectMusicBand
*
band
;
}
DMUS_PRIVATE_BAND
,
*
LPDMUS_PRIVATE_BAND
;
/*****************************************************************************
* 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