]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm_hw: close file descriptor in the error path in snd_pcm_hw_open() (coverity)
authorJaroslav Kysela <perex@perex.cz>
Fri, 24 May 2019 09:11:46 +0000 (11:11 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 24 May 2019 19:25:50 +0000 (21:25 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_hw.c

index 91370a88c0fdece71c8aef96e83837858a583c9b..77d4dae1b20bd835a4f621b9e522a5f2f5ed4db3 100644 (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;
 }