Skip to content

Commit 08043c6

Browse files
committed
oscmain: fix segfault by properly checking error codes
iio_create_context() now returns an error pointer instead of NULL when a context is not properly created. This was later leading to a segmentation fault. Signed-off-by: Nuno Sá <[email protected]>
1 parent 55b6470 commit 08043c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

oscmain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ gint main (int argc, char **argv)
208208
switch (c) {
209209
case 'u':
210210
ctx = iio_create_context(NULL, optarg);
211-
if (!ctx) {
211+
if (iio_err(ctx)) {
212212
printf("Failed connecting to remote device: %s\n", optarg);
213213
exit(-1);
214214
}

0 commit comments

Comments
 (0)