From a0bf44e115c0b89f7a2c8090d3b169daad8bd543 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 24 Nov 2014 14:06:49 -0600 Subject: cpukit/dev/i2c/i2c-dev.c: Fix leak on error path Coverity ID 1255520. fd was not closed on error path. --- cpukit/dev/i2c/i2c-dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cpukit/dev') diff --git a/cpukit/dev/i2c/i2c-dev.c b/cpukit/dev/i2c/i2c-dev.c index b03effd1df..cf1cf41ba8 100644 --- a/cpukit/dev/i2c/i2c-dev.c +++ b/cpukit/dev/i2c/i2c-dev.c @@ -224,14 +224,13 @@ static int i2c_dev_do_init( fd = open(bus_path, O_RDWR); if (fd < 0) { (*destroy)(dev); - return -1; } rv = ioctl(fd, I2C_BUS_GET_CONTROL, &dev->bus); if (rv != 0) { + (void) close(fd); (*destroy)(dev); - return -1; } -- cgit v1.2.3