1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

ao: fix potential NULL deref in ao_device_list_add()

Probably didn't happen in practice, but anyway.

Found by coverity.
This commit is contained in:
wm4 2017-02-20 13:50:37 +01:00
parent 64b1a656c7
commit 06619f53a8

View File

@ -605,8 +605,8 @@ void ao_device_list_add(struct ao_device_list *list, struct ao *ao,
c.desc = "Default";
}
}
c.name = c.name[0] ? talloc_asprintf(list, "%s/%s", dname, c.name)
: talloc_strdup(list, dname);
c.name = (c.name && c.name[0]) ? talloc_asprintf(list, "%s/%s", dname, c.name)
: talloc_strdup(list, dname);
c.desc = talloc_strdup(list, c.desc);
MP_TARRAY_APPEND(list, list->devices, list->num_devices, c);
}