Skip to content

Commit ddbc719

Browse files
AlisonSchofieldjic23
authored andcommitted
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>
1 parent 0d9dcf8 commit ddbc719

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/iio/iio_generic_buffer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ int main(int argc, char **argv)
348348
int notrigger = 0;
349349
char *dummy;
350350

351-
struct iio_channel_info *channels;
351+
struct iio_channel_info *channels = NULL;
352352

353353
register_cleanup();
354354

0 commit comments

Comments
 (0)