]> git.sesse.net Git - vlc/commitdiff
ALSA: log the device string that is actually opened
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 16 Mar 2015 18:04:33 +0000 (20:04 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 16 Mar 2015 18:04:33 +0000 (20:04 +0200)
modules/audio_output/alsa.c

index 9e0fe10274b16995ab4003fc46da7bf06c286d0a..fd40d85d2dca3d91dd7445fcbed6428a2c364db2 100644 (file)
@@ -382,20 +382,21 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     const int mode = SND_PCM_NO_AUTO_RESAMPLE;
 
     int val = snd_pcm_open (&pcm, device, SND_PCM_STREAM_PLAYBACK, mode);
-    free (devbuf);
     if (val != 0)
     {
-        msg_Err (aout, "cannot open ALSA device \"%s\": %s", sys->device,
+        msg_Err (aout, "cannot open ALSA device \"%s\": %s", device,
                  snd_strerror (val));
         dialog_Fatal (aout, _("Audio output failed"),
                       _("The audio device \"%s\" could not be used:\n%s."),
                       sys->device, snd_strerror (val));
+        free (devbuf);
         return VLC_EGENERIC;
     }
     sys->pcm = pcm;
 
     /* Print some potentially useful debug */
-    msg_Dbg (aout, "using ALSA device: %s", sys->device);
+    msg_Dbg (aout, "using ALSA device: %s", device);
+    free (devbuf);
     DumpDevice (VLC_OBJECT(aout), pcm);
 
     /* Get Initial hardware parameters */