Fix segfault with strdup(NULL) in softvol

The last change to fix the slave name may cause a segfault when
name=NULL is passed.  Fixed now.
This commit is contained in:
Takashi Iwai 2007-12-13 15:49:50 +01:00
parent 6e6f4b9c93
commit 74880110c3

View 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! */ if (err > 0) { /* hardware control - no need for softvol! */
softvol_free(svol); softvol_free(svol);
*pcmp = slave; /* just pass the slave */ *pcmp = slave; /* just pass the slave */
if (!slave->name) if (!slave->name && name)
slave->name = strdup(name); slave->name = strdup(name);
return 0; return 0;
} }