pcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-05-24 11:11:46 +02:00
parent 22ade9b8c1
commit 3ae743efea

View file

@ -1724,12 +1724,15 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
}
if (info.subdevice != (unsigned int) subdevice) {
close(fd);
fd = -1;
goto __again;
}
}
snd_ctl_close(ctl);
return snd_pcm_hw_open_fd(pcmp, name, fd, sync_ptr_ioctl);
_err:
if (fd >= 0)
close(fd);
snd_ctl_close(ctl);
return ret;
}