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.
This commit is contained in:
parent
5ba43e4ac2
commit
a0603d8897
@ -36,9 +36,8 @@ static void
|
|||||||
alsa_mixer_finish(struct mixer_data *data)
|
alsa_mixer_finish(struct mixer_data *data)
|
||||||
{
|
{
|
||||||
struct alsa_mixer *am = (struct alsa_mixer *)data;
|
struct alsa_mixer *am = (struct alsa_mixer *)data;
|
||||||
if (am->device)
|
|
||||||
g_free(am->device);
|
g_free(am->device);
|
||||||
if (am->control)
|
|
||||||
g_free(am->control);
|
g_free(am->control);
|
||||||
g_free(am);
|
g_free(am);
|
||||||
}
|
}
|
||||||
@ -53,12 +52,10 @@ alsa_mixer_configure(struct mixer_data *data, struct config_param *param)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if ((bp = getBlockParam(param, "mixer_device"))) {
|
if ((bp = getBlockParam(param, "mixer_device"))) {
|
||||||
if (am->device)
|
|
||||||
g_free(am->device);
|
g_free(am->device);
|
||||||
am->device = g_strdup(bp->value);
|
am->device = g_strdup(bp->value);
|
||||||
}
|
}
|
||||||
if ((bp = getBlockParam(param, "mixer_control"))) {
|
if ((bp = getBlockParam(param, "mixer_control"))) {
|
||||||
if (am->control)
|
|
||||||
g_free(am->control);
|
g_free(am->control);
|
||||||
am->control = g_strdup(bp->value);
|
am->control = g_strdup(bp->value);
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ static void
|
|||||||
oss_mixer_finish(struct mixer_data *data)
|
oss_mixer_finish(struct mixer_data *data)
|
||||||
{
|
{
|
||||||
struct oss_mixer *om = (struct oss_mixer *) data;
|
struct oss_mixer *om = (struct oss_mixer *) data;
|
||||||
if (om->device)
|
|
||||||
g_free(om->device);
|
g_free(om->device);
|
||||||
if (om->control)
|
|
||||||
g_free(om->control);
|
g_free(om->control);
|
||||||
g_free(om);
|
g_free(om);
|
||||||
}
|
}
|
||||||
@ -58,13 +57,12 @@ oss_mixer_configure(struct mixer_data *data, struct config_param *param)
|
|||||||
|
|
||||||
bp = getBlockParam(param, "mixer_device");
|
bp = getBlockParam(param, "mixer_device");
|
||||||
if (bp) {
|
if (bp) {
|
||||||
if (om->device)
|
|
||||||
g_free(om->device);
|
g_free(om->device);
|
||||||
om->device = g_strdup(bp->value);
|
om->device = g_strdup(bp->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bp = getBlockParam(param, "mixer_control");
|
bp = getBlockParam(param, "mixer_control");
|
||||||
if (bp) {
|
if (bp) {
|
||||||
if (om->control)
|
|
||||||
g_free(om->control);
|
g_free(om->control);
|
||||||
om->control = g_strdup(bp->value);
|
om->control = g_strdup(bp->value);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user