summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-24 14:06:49 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-25 12:57:08 -0600
commita0bf44e115c0b89f7a2c8090d3b169daad8bd543 (patch)
treef3a59e271a46bd7a92478999e53cbedacb5597c7 /cpukit
parentcapture: Resolve failure path memory leak. (diff)
downloadrtems-a0bf44e115c0b89f7a2c8090d3b169daad8bd543.tar.bz2
cpukit/dev/i2c/i2c-dev.c: Fix leak on error path
Coverity ID 1255520. fd was not closed on error path.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/dev/i2c/i2c-dev.c3
1 files changed, 1 insertions, 2 deletions
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;
}