Module: wine Branch: master Commit: 4ae866a0a7f65a4a4d2c95c5c98145b02d63528e URL: https://gitlab.winehq.org/wine/wine/-/commit/4ae866a0a7f65a4a4d2c95c5c98145b...
Author: Rémi Bernon rbernon@codeweavers.com Date: Sat Sep 9 14:51:56 2023 +0200
dmusic: Stop leaking instruments on collection release.
---
dlls/dmusic/collection.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 0b4e23b34f4..2d4a7f855ae 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -98,7 +98,18 @@ static ULONG WINAPI collection_Release(IDirectMusicCollection *iface)
TRACE("(%p): new ref = %lu\n", iface, ref);
- if (!ref) { + if (!ref) + { + struct instrument_entry *instrument_entry; + void *next; + + LIST_FOR_EACH_ENTRY_SAFE(instrument_entry, next, &This->instruments, struct instrument_entry, entry) + { + list_remove(&instrument_entry->entry); + IDirectMusicInstrument_Release(instrument_entry->instrument); + free(instrument_entry); + } + free(This); }