diff options
author | Hartmut Knaack <knaack.h@gmx.de> | 2015-05-31 14:39:44 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-31 17:20:16 +0100 |
commit | 63f05c855f3825b89b92cd21df0415e6e32af3dd (patch) | |
tree | d798e25a74fd44dad2c3311b88ffd42cd55d1bf8 /tools/iio/iio_utils.c | |
parent | 66dd08fde06e5ad6f0f86c7a780d60973e9d9cf0 (diff) | |
download | linux-63f05c855f3825b89b92cd21df0415e6e32af3dd.tar.gz linux-63f05c855f3825b89b92cd21df0415e6e32af3dd.tar.bz2 linux-63f05c855f3825b89b92cd21df0415e6e32af3dd.zip |
tools:iio: free channel-array completely
In iio_utils.c build_channel_array() dynamically allocates the string
generic_name in the current iio_channel_info, which doesn't got freed in
case of an error.
This dynamically allocated channel-array is used by generic_buffer, and
needs to be freed on the error/exit path.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio/iio_utils.c')
-rw-r--r-- | tools/iio/iio_utils.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index f879ad7b88bc..6daf98fdde1a 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -410,8 +410,10 @@ int build_channel_array(const char *device_dir, return 0; error_cleanup_array: - for (i = count - 1; i >= 0; i--) + for (i = count - 1; i >= 0; i--) { free((*ci_array)[i].name); + free((*ci_array)[i].generic_name); + } free(*ci_array); error_close_dir: closedir(dp); |