aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer
diff options
context:
space:
mode:
authorViliam Mateicka <viliam.mateicka@gmail.com>2009-01-10 21:33:38 +0100
committerMax Kellermann <max@duempel.org>2009-01-11 17:13:01 +0100
commitd357f585426d31b2b7e8efd3b92163b7b4f3c3f6 (patch)
treeab719858bf7ce0f6cd26ae077762c721f4145b4c /src/mixer
parent983822ea525f0d48c8329513c846fe183bd0353f (diff)
downloadmpd-d357f585426d31b2b7e8efd3b92163b7b4f3c3f6.tar.gz
mpd-d357f585426d31b2b7e8efd3b92163b7b4f3c3f6.tar.xz
mpd-d357f585426d31b2b7e8efd3b92163b7b4f3c3f6.zip
removing mixer_reconfigure memmory leak, fixing configure of alsa and oss mixer (passing parameters)
Diffstat (limited to '')
-rw-r--r--src/mixer/alsa_mixer.c18
-rw-r--r--src/mixer/oss_mixer.c16
2 files changed, 26 insertions, 8 deletions
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
diff --git a/src/mixer/oss_mixer.c b/src/mixer/oss_mixer.c
index db8431ab9..75f1f5a0b 100644
--- a/src/mixer/oss_mixer.c
+++ b/src/mixer/oss_mixer.c
@@ -19,8 +19,8 @@
#define VOLUME_MIXER_OSS_DEFAULT "/dev/mixer"
struct oss_mixer {
- const char *device;
- const char *control;
+ char *device;
+ char *control;
int device_fd;
int volume_control;
};
@@ -40,6 +40,10 @@ static void
oss_mixer_finish(struct mixer_data *data)
{
struct oss_mixer *om = (struct oss_mixer *) data;
+ if (om->device)
+ g_free(om->device);
+ if (om->control)
+ g_free(om->control);
g_free(om);
}
@@ -50,11 +54,15 @@ oss_mixer_configure(struct mixer_data *data, ConfigParam *param)
BlockParam *bp;
bp = getBlockParam(param, "mixer_device");
if (bp) {
- om->device = bp->value;
+ if (om->device)
+ g_free(om->device);
+ om->device = g_strdup(bp->value);
}
bp = getBlockParam(param, "mixer_control");
if (bp) {
- om->control = bp->value;
+ if (om->control)
+ g_free(om->control);
+ om->control = g_strdup(bp->value);
}
}