[PATCH v8 04/11] sound: Free more on SndChannel finalize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/sound.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index 6c6d65d..20c4337 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1434,10 +1434,26 @@ snd_channel_init(SndChannel *self)
 }
 
 static void
+snd_channel_finalize(GObject *object)
+{
+    SndChannel *channel = SND_CHANNEL(object);
+
+    remove_channel(channel);
+
+    free(channel->volume.volume);
+    channel->volume.volume = NULL;
+
+    G_OBJECT_CLASS(snd_channel_parent_class)->finalize(object);
+}
+
+static void
 snd_channel_class_init(SndChannelClass *klass)
 {
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
     RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
 
+    object_class->finalize = snd_channel_finalize;
+
     channel_class->config_socket = snd_channel_config_socket;
     channel_class->alloc_recv_buf = snd_channel_client_alloc_recv_buf;
     channel_class->release_recv_buf = snd_channel_client_release_recv_buf;
@@ -1553,10 +1569,7 @@ static void snd_detach_common(SndChannel *channel)
     }
     RedsState *reds = red_channel_get_server(RED_CHANNEL(channel));
 
-    remove_channel(channel);
     reds_unregister_channel(reds, RED_CHANNEL(channel));
-    free(channel->volume.volume);
-    channel->volume.volume = NULL;
     red_channel_destroy(RED_CHANNEL(channel));
 }
 
-- 
git-series 0.9.1
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]