diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2012-06-25 21:13:24 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-06-30 09:12:21 (GMT) |
commit | 578f737dd36989121412cf947a5b534e7b8a0ac5 (patch) | |
tree | 5436426c03e8437a41e2b54ae515d22bccf6e35d | |
parent | 6b16351acbd415e66ba16bf7d473ece1574cf0bc (diff) | |
download | linux-fsl-qoriq-578f737dd36989121412cf947a5b534e7b8a0ac5.tar.xz |
iio staging: fix potential resource leak in generic_buffer
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/staging/iio/Documentation/iio_utils.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6f3a392..ab78859 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -157,7 +157,8 @@ inline int iioutils_get_type(unsigned *is_signed, &padint, shift); if (ret < 0) { printf("failed to pass scan type description\n"); - return ret; + ret = -errno; + goto error_close_sysfsfp; } *be = (endianchar == 'b'); *bytes = padint / 8; @@ -173,7 +174,11 @@ inline int iioutils_get_type(unsigned *is_signed, free(filename); filename = 0; + sysfsfp = 0; } +error_close_sysfsfp: + if (sysfsfp) + fclose(sysfsfp); error_free_filename: if (filename) free(filename); |