output/alsa: default "device" is an empty string

Fixes nullptr dereference in std::string::operator=().  Also fixes a
memory leak by using config_get_block_string() instead of
config_dup_block_string().
This commit is contained in:
Max Kellermann 2013-02-04 11:46:49 +01:00
parent 5692e20fd5
commit 7e92820c50

View File

@ -137,7 +137,7 @@ alsa_device(const AlsaOutput *ad)
static void static void
alsa_configure(AlsaOutput *ad, const struct config_param *param) alsa_configure(AlsaOutput *ad, const struct config_param *param)
{ {
ad->device = config_dup_block_string(param, "device", NULL); ad->device = config_get_block_string(param, "device", "");
ad->use_mmap = config_get_block_bool(param, "use_mmap", false); ad->use_mmap = config_get_block_bool(param, "use_mmap", false);