From: Jaroslav Kysela Date: Fri, 24 May 2019 09:11:46 +0000 (+0200) Subject: pcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity) X-Git-Tag: v1.2.1~62 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=3ae743efea704c16c9464f38d502c23759b71245;p=alsa-lib.git pcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity) Signed-off-by: Jaroslav Kysela --- diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 91370a88..77d4dae1 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -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; }