From 2759c90a67ae991d58c7104265983bc125d8c69f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 3 Aug 2006 17:27:35 +0200 Subject: [PATCH] Fix segfault in aplay when snd_pcm_name() == NULL Fix segfault in aplay when snd_pcm_name() == NULL. --- aplay/aplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)",