mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 21:55:42 +01:00
alsactl: load_state: Only delete config if one was loaded
If load_configuration fails with open_failed == true, load_state will
jump to the out label without config being initialized and pass this
uninitialized config value to snd_config_delete. This commit fixes this
issue by initializing config with NULL and checking if it is non-null
before invoking snd_config_delete.
Fixes: https://github.com/alsa-project/alsa-utils/pull/94
Fixes: f138117
("alsactl: load_state() - initialize config variable for the open_failed case")
BugLink: https://github.com/alsa-project/alsa-utils/issues/93
Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
f138117a45
commit
6018c2014a
1 changed files with 2 additions and 1 deletions
|
@ -1692,7 +1692,8 @@ int load_state(const char *cfgdir, const char *file,
|
||||||
}
|
}
|
||||||
err = finalerr ? finalerr : snd_card_iterator_error(&iter);
|
err = finalerr ? finalerr : snd_card_iterator_error(&iter);
|
||||||
out:
|
out:
|
||||||
snd_config_delete(config);
|
if (config)
|
||||||
|
snd_config_delete(config);
|
||||||
snd_config_update_free_global();
|
snd_config_update_free_global();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue