From 06619f53a8a4e390919b90db30bf12b2499b5b95 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Feb 2017 13:50:37 +0100 Subject: ao: fix potential NULL deref in ao_device_list_add() Probably didn't happen in practice, but anyway. Found by coverity. --- audio/out/ao.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/out/ao.c b/audio/out/ao.c index 6cf8de2d88..e643945ec7 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -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); } -- cgit v1.2.3