提交 065896e9 编写于 作者: M Michael Hennerich 提交者: Greg Kroah-Hartman

IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference

In case optarg n is not given return/exit
Signed-off-by: NMichael Hennerich <michael.hennerich@analog.com>
Acked-by: NJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 7c31b984
...@@ -168,6 +168,9 @@ int main(int argc, char **argv) ...@@ -168,6 +168,9 @@ int main(int argc, char **argv)
} }
} }
if (device_name == NULL)
return -1;
/* Find the device requested */ /* Find the device requested */
dev_num = find_type_by_name(device_name, "device"); dev_num = find_type_by_name(device_name, "device");
if (dev_num < 0) { if (dev_num < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册