[Spice-devel] [PATCH spice-server 03/11] sound: Use GLib memory functions

Frediano Ziglio fziglio at redhat.com
Mon Sep 11 15:15:45 UTC 2017


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/sound.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index de51a4670..9073626cd 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -795,7 +795,7 @@ snd_channel_client_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t
     SndChannelClient *client = SND_CHANNEL_CLIENT(rcc);
     // If message is too big allocate one, this should never happen
     if (size > sizeof(client->receive_buf)) {
-        return spice_malloc(size);
+        return g_malloc(size);
     }
     return client->receive_buf;
 }
@@ -806,7 +806,7 @@ snd_channel_client_release_recv_buf(RedChannelClient *rcc, uint16_t type, uint32
 {
     SndChannelClient *client = SND_CHANNEL_CLIENT(rcc);
     if (msg != client->receive_buf) {
-        free(msg);
+        g_free(msg);
     }
 }
 
@@ -825,8 +825,8 @@ static void snd_channel_set_volume(SndChannel *channel,
     SndChannelClient *client = snd_channel_get_client(channel);
 
     st->volume_nchannels = nchannels;
-    free(st->volume);
-    st->volume = spice_memdup(volume, sizeof(uint16_t) * nchannels);
+    g_free(st->volume);
+    st->volume = g_memdup(volume, sizeof(uint16_t) * nchannels);
 
     if (!client || nchannels == 0)
         return;
@@ -951,7 +951,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_put_samples(SpicePlaybackInstance
     if (frame->allocated) {
         frame->allocated = false;
         if (--frame->container->refs == 0) {
-            free(frame->container);
+            g_free(frame->container);
             return;
         }
     }
@@ -1025,7 +1025,7 @@ playback_channel_client_finalize(GObject *object)
         playback_client->frames->items[i].client = NULL;
     }
     if (--playback_client->frames->refs == 0) {
-        free(playback_client->frames);
+        g_free(playback_client->frames);
     }
 
     if (client->active) {
@@ -1302,7 +1302,7 @@ snd_channel_finalize(GObject *object)
 
     remove_channel(channel);
 
-    free(channel->volume.volume);
+    g_free(channel->volume.volume);
     channel->volume.volume = NULL;
 
     G_OBJECT_CLASS(snd_channel_parent_class)->finalize(object);
@@ -1490,7 +1490,7 @@ static void snd_playback_alloc_frames(PlaybackChannelClient *playback)
 {
     int i;
 
-    playback->frames = spice_new0(AudioFrameContainer, 1);
+    playback->frames = g_new0(AudioFrameContainer, 1);
     playback->frames->refs = 1;
     for (i = 0; i < NUM_AUDIO_FRAMES; ++i) {
         playback->frames->items[i].container = playback->frames;
-- 
2.13.5



More information about the Spice-devel mailing list