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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nikola Pajkovsky <npajkovs@xxxxxxxxxx>
---
 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


_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux