sound: Use GLib memory functions

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-09-11 16:15:45 +01:00
parent 8626f5bf3e
commit 0da0673bd3

View File

@ -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;