diff options
author | Alison Schofield <amsfield22@gmail.com> | 2016-07-27 05:17:43 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-08-15 18:05:30 +0200 |
commit | ddbc719f99cf9aed6918cef98cb3475fd4fc4fa6 (patch) | |
tree | 70a3b81e810ada06a5426e0d3e8a17918b28c255 /tools | |
parent | iio: humidity: hdc100x: fix sensor data reads of temp and humidity (diff) | |
download | linux-ddbc719f99cf9aed6918cef98cb3475fd4fc4fa6.tar.xz linux-ddbc719f99cf9aed6918cef98cb3475fd4fc4fa6.zip |
tools: iio: iio_generic_buffer: initialize channel array pointer
Uninitialized channel pointer causes segmentation fault when we
call free(channel) during cleanup() with no channels initialized.
This happens when you exit early for usage errors. Initialize
the pointer to NULL when it is declared.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Tested-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/iio/iio_generic_buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index 0e8a1f7a292d..ae68bf0e2d51 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c @@ -348,7 +348,7 @@ int main(int argc, char **argv) int notrigger = 0; char *dummy; - struct iio_channel_info *channels; + struct iio_channel_info *channels = NULL; register_cleanup(); |