]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: silence potential NULL dereference compiler warning
authorGerhard Sittig <redacted>
Fri, 9 Feb 2018 18:30:00 +0000 (19:30 +0100)
committerUwe Hermann <redacted>
Fri, 9 Feb 2018 20:37:40 +0000 (21:37 +0100)
Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

src/hardware/sysclk-lwla/api.c

index 085f46c7bc7cefab8d8fc0f2a9e107da1fcd17e8..231df4dbf270b2181c6f8ea3f7f59e98aa6116f1 100644 (file)
@@ -588,6 +588,8 @@ static int config_list(uint32_t key, GVariant **data,
                        (devc) ? devc->model->num_devopts : 0);
        }
 
+       if (!devc)
+               return SR_ERR_ARG;
        if (!has_devopt(devc->model, key | SR_CONF_LIST))
                return SR_ERR_NA;