From a0603d8897a7066564172c086b6e532d8a5a40c5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 18 Jan 2009 18:55:51 +0100 Subject: mixer: don't check for NULL before g_free() The g_free() function includes a NULL check. We don't have to do it twice. --- src/mixer/alsa_mixer.c | 13 +++++-------- src/mixer/oss_mixer.c | 14 ++++++-------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c index 2433d5b9c..72924058b 100644 --- a/src/mixer/alsa_mixer.c +++ b/src/mixer/alsa_mixer.c @@ -36,10 +36,9 @@ 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->device); + g_free(am->control); g_free(am); } @@ -53,13 +52,11 @@ alsa_mixer_configure(struct mixer_data *data, struct config_param *param) return; if ((bp = getBlockParam(param, "mixer_device"))) { - if (am->device) - g_free(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); + g_free(am->control); am->control = g_strdup(bp->value); } } diff --git a/src/mixer/oss_mixer.c b/src/mixer/oss_mixer.c index a6c7684d2..0ee44a693 100644 --- a/src/mixer/oss_mixer.c +++ b/src/mixer/oss_mixer.c @@ -40,10 +40,9 @@ 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->device); + g_free(om->control); g_free(om); } @@ -58,14 +57,13 @@ oss_mixer_configure(struct mixer_data *data, struct config_param *param) bp = getBlockParam(param, "mixer_device"); if (bp) { - if (om->device) - g_free(om->device); + g_free(om->device); om->device = g_strdup(bp->value); } + bp = getBlockParam(param, "mixer_control"); if (bp) { - if (om->control) - g_free(om->control); + g_free(om->control); om->control = g_strdup(bp->value); } } -- cgit v1.2.3