Michael Stefaniuc : dmstyle: Free lists when IDirectMusicStyleImpl is destroyed.

Alexandre Julliard julliard at winehq.org
Tue Nov 26 16:21:25 CST 2019


Module: wine
Branch: master
Commit: e4e3c0b41727b42712960753c652e9cc780e05aa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e4e3c0b41727b42712960753c652e9cc780e05aa

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Nov 26 21:14:40 2019 +0100

dmstyle: Free lists when IDirectMusicStyleImpl is destroyed.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmstyle/style.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c
index 7c835afe27..b3bce9bba2 100644
--- a/dlls/dmstyle/style.c
+++ b/dlls/dmstyle/style.c
@@ -108,7 +108,25 @@ static ULONG WINAPI IDirectMusicStyle8Impl_Release(IDirectMusicStyle8 *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if (!ref) {
-        HeapFree(GetProcessHeap(), 0, This);
+        struct style_band *band, *band2;
+        struct style_motif *motif, *motif2;
+        struct style_partref_item *item, *item2;
+
+        LIST_FOR_EACH_ENTRY_SAFE(band, band2, &This->bands, struct style_band, entry) {
+            list_remove(&band->entry);
+            if (band->pBand)
+                IDirectMusicBand_Release(band->pBand);
+            heap_free(band);
+        }
+        LIST_FOR_EACH_ENTRY_SAFE(motif, motif2, &This->motifs, struct style_motif, entry) {
+            list_remove(&motif->entry);
+            LIST_FOR_EACH_ENTRY_SAFE(item, item2, &motif->Items, struct style_partref_item, entry) {
+                list_remove(&item->entry);
+                heap_free(item);
+            }
+            heap_free(motif);
+        }
+        heap_free(This);
         DMSTYLE_UnlockModule();
     }
 




More information about the wine-cvs mailing list