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:
parent
7c31b984c4
commit
065896e904
1 changed files with 3 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue