]> git.alsa-project.org Git - alsa-utils.git/commitdiff
Fix segfault in aplay when snd_pcm_name() == NULL
authorTakashi Iwai <tiwai@suse.de>
Thu, 3 Aug 2006 15:27:35 +0000 (17:27 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 3 Aug 2006 15:27:35 +0000 (17:27 +0200)
Fix segfault in aplay when snd_pcm_name() == NULL.

aplay/aplay.c

index c1c59f9488d980f28bb1abc4e03ed74b824b3fda..38643221e3c5898f17e2429203b5b9a77c859e9d 100644 (file)
@@ -918,8 +918,9 @@ static void set_params(void)
        if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
                if (!quiet_mode) {
                        char plugex[64];
+                       const char *pcmname = snd_pcm_name(handle);
                        fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate);
-                       if (strchr(snd_pcm_name(handle), ':'))
+                       if (! pcmname || strchr(snd_pcm_name(handle), ':'))
                                *plugex = 0;
                        else
                                snprintf(plugex, sizeof(plugex), "(-Dplug:%s)",