]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix segfault with strdup(NULL) in softvol
authorTakashi Iwai <tiwai@suse.de>
Thu, 13 Dec 2007 14:49:50 +0000 (15:49 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 13 Dec 2007 14:49:50 +0000 (15:49 +0100)
The last change to fix the slave name may cause a segfault when
name=NULL is passed.  Fixed now.

src/pcm/pcm_softvol.c

index 97894bb4338f74454903acfe93ffc577650daea8..45dae534c7acee0bc5169d98680f6e17fff38548 100644 (file)
@@ -782,7 +782,7 @@ int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
        if (err > 0) { /* hardware control - no need for softvol! */
                softvol_free(svol);
                *pcmp = slave; /* just pass the slave */
-               if (!slave->name)
+               if (!slave->name && name)
                        slave->name = strdup(name);
                return 0;
        }