summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-20 13:50:37 +0100
committerwm4 <wm4@nowhere>2017-02-20 13:50:37 +0100
commit06619f53a8a4e390919b90db30bf12b2499b5b95 (patch)
treed015c4f448e864499a17e3f30463a4f8252a6ea4 /audio
parent64b1a656c7097716c7f0e96a4600a936d9ee9dea (diff)
downloadmpv-06619f53a8a4e390919b90db30bf12b2499b5b95.tar.bz2
mpv-06619f53a8a4e390919b90db30bf12b2499b5b95.tar.xz
ao: fix potential NULL deref in ao_device_list_add()
Probably didn't happen in practice, but anyway. Found by coverity.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao.c4
1 files changed, 2 insertions, 2 deletions
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);
}