[PATCH v2 4/4] dmime: Free list when SegTrigger track is destroyed.

Michael Stefaniuc mstefani at winehq.org
Thu Nov 14 13:40:27 CST 2019


From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
v2: Avoid LPJUNK style types


 dlls/dmime/segtriggertrack.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c
index 4b3a71c9a4..3050a5031b 100644
--- a/dlls/dmime/segtriggertrack.c
+++ b/dlls/dmime/segtriggertrack.c
@@ -21,6 +21,8 @@
 #include "dmime_private.h"
 #include "dmobject.h"
 
+#include "wine/heap.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(dmime);
 WINE_DECLARE_DEBUG_CHANNEL(dmfile);
 
@@ -81,7 +83,19 @@ static ULONG WINAPI segment_track_Release(IDirectMusicTrack8 *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if (!ref) {
-        HeapFree(GetProcessHeap(), 0, This);
+        struct list *cursor, *cursor2;
+        DMUS_PRIVATE_SEGMENT_ITEM *item;
+
+        LIST_FOR_EACH_SAFE(cursor, cursor2, &This->Items) {
+            item = LIST_ENTRY(cursor, DMUS_PRIVATE_SEGMENT_ITEM, entry);
+            list_remove(cursor);
+
+            if (item->pObject)
+                IDirectMusicObject_Release(item->pObject);
+            heap_free(item);
+        }
+
+        heap_free(This);
         DMIME_UnlockModule();
     }
 
-- 
2.20.1




More information about the wine-devel mailing list