From d357f585426d31b2b7e8efd3b92163b7b4f3c3f6 Mon Sep 17 00:00:00 2001 From: Viliam Mateicka Date: Sat, 10 Jan 2009 21:33:38 +0100 Subject: removing mixer_reconfigure memmory leak, fixing configure of alsa and oss mixer (passing parameters) --- src/mixer/alsa_mixer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/mixer/alsa_mixer.c') diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c index 6930fa8a0..86a9ae86e 100644 --- a/src/mixer/alsa_mixer.c +++ b/src/mixer/alsa_mixer.c @@ -36,6 +36,10 @@ static void alsa_mixer_finish(struct mixer_data *data) { struct alsa_mixer *am = (struct alsa_mixer *)data; + if (am->device) + g_free(am->device); + if (am->control) + g_free(am->control); g_free(am); } @@ -45,10 +49,16 @@ alsa_mixer_configure(struct mixer_data *data, ConfigParam *param) struct alsa_mixer *am = (struct alsa_mixer *)data; BlockParam *bp; - if ((bp = getBlockParam(param, "mixer_device"))) - am->device = bp->value; - if ((bp = getBlockParam(param, "mixer_control"))) - am->control = bp->value; + if ((bp = getBlockParam(param, "mixer_device"))) { + if (am->device) + g_free(am->device); + am->device = g_strdup(bp->value); + } + if ((bp = getBlockParam(param, "mixer_control"))) { + if (am->control) + g_free(am->control); + am->control = g_strdup(bp->value); + } } static void -- cgit v1.2.3