From: Gerhard Sittig Date: Fri, 9 Feb 2018 18:30:00 +0000 (+0100) Subject: sysclk-lwla: silence potential NULL dereference compiler warning X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=aedbf89d85cc7efa1263f5e210c3b78097ad471a;p=libsigrok.git sysclk-lwla: silence potential NULL dereference compiler warning Check pointers' validity before dereferencing them. This was reported by clang's scan-build. --- diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 085f46c7..231df4db 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -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;