summaryrefslogtreecommitdiffstats
path: root/stream/ai_alsa1x.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-30 15:51:26 +0100
committerwm4 <wm4@nowhere>2015-10-30 15:51:26 +0100
commit05e39ec51362d9c23f0652a4ac5017a1b6489e49 (patch)
tree0e3766c65f5e698a3cb4496f9822e034de67f3ff /stream/ai_alsa1x.c
parent7aba3a5d96b0d3b22c9e93057b6d1b4cba0e5104 (diff)
downloadmpv-05e39ec51362d9c23f0652a4ac5017a1b6489e49.tar.bz2
mpv-05e39ec51362d9c23f0652a4ac5017a1b6489e49.tar.xz
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.
Diffstat (limited to 'stream/ai_alsa1x.c')
-rw-r--r--stream/ai_alsa1x.c6
1 files changed, 5 insertions, 1 deletions
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;