From: Takashi Iwai Date: Thu, 3 Aug 2006 15:27:35 +0000 (+0200) Subject: Fix segfault in aplay when snd_pcm_name() == NULL X-Git-Tag: v1.0.12rc2~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2759c90a67ae991d58c7104265983bc125d8c69f;p=alsa-utils.git Fix segfault in aplay when snd_pcm_name() == NULL Fix segfault in aplay when snd_pcm_name() == NULL. --- diff --git a/aplay/aplay.c b/aplay/aplay.c index c1c59f9..3864322 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -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)",