diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-24 14:06:49 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-25 12:57:08 -0600 |
commit | a0bf44e115c0b89f7a2c8090d3b169daad8bd543 (patch) | |
tree | f3a59e271a46bd7a92478999e53cbedacb5597c7 /cpukit/dev/i2c/i2c-dev.c | |
parent | capture: Resolve failure path memory leak. (diff) | |
download | rtems-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/dev/i2c/i2c-dev.c')
-rw-r--r-- | cpukit/dev/i2c/i2c-dev.c | 3 |
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; } |