From 05e39ec51362d9c23f0652a4ac5017a1b6489e49 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 30 Oct 2015 15:51:26 +0100 Subject: stream/audio: fix unchecked strdups See #2435. It's literally a waste of time trying to fix minor memory leaks in this old, unused, and crappy code. --- stream/ai_alsa1x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stream/ai_alsa1x.c') diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c index c5dc84cfcc..8f2b774faf 100644 --- a/stream/ai_alsa1x.c +++ b/stream/ai_alsa1x.c @@ -134,7 +134,11 @@ int ai_alsa_init(audio_in_t *ai) { int err; - err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0); + const char *device = ai->alsa.device; + if (!device) + device = "default"; + + err = snd_pcm_open(&ai->alsa.handle, device, SND_PCM_STREAM_CAPTURE, 0); if (err < 0) { MP_ERR(ai, "Error opening audio: %s\n", snd_strerror(err)); return -1; -- cgit v1.2.3