[lm-sensors] [PATCH] eepromer/24cXX: fix leaking file descriptor

Nikola Pajkovsky npajkovs at redhat.com
Tue Apr 24 12:24:54 CEST 2012


Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>
---
 eepromer/24cXX.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eepromer/24cXX.c b/eepromer/24cXX.c
index 00a21fd..ab86c33 100644
--- a/eepromer/24cXX.c
+++ b/eepromer/24cXX.c
@@ -79,9 +79,10 @@ int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom* e)
 		return -1;
 
 	// get funcs list
-	if((r = ioctl(fd, I2C_FUNCS, &funcs) < 0))
+	if((r = ioctl(fd, I2C_FUNCS, &funcs) < 0)) {
+		close(fd);
 		return r;
-
+	}
 	
 	// check for req funcs
 	CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_READ_BYTE );
-- 
1.7.9.3





More information about the lm-sensors mailing list