Archived
14
0
Fork 0

IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference

In case optarg n is not given return/exit

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Michael Hennerich 2011-02-24 16:34:50 +01:00 committed by Greg Kroah-Hartman
parent 7c31b984c4
commit 065896e904

View file

@ -168,6 +168,9 @@ int main(int argc, char **argv)
}
}
if (device_name == NULL)
return -1;
/* Find the device requested */
dev_num = find_type_by_name(device_name, "device");
if (dev_num < 0) {