Blob Blame History Raw
From 3ae743efea704c16c9464f38d502c23759b71245 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 24 May 2019 11:11:46 +0200
Subject: [PATCH 17/25] pcm_hw: close file descriptor in the error path in
 snd_pcm_hw_open() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 src/pcm/pcm_hw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 91370a88c0fd..77d4dae1b20b 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;
 }
-- 
2.16.4