From: Gerhard Sittig Date: Fri, 9 Feb 2018 18:26:42 +0000 (+0100) Subject: rigol-ds: silence potential NULL dereference compiler warning X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0306ae30b692413b79c69df34a8916727c0282b6;p=libsigrok.git rigol-ds: 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/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 443d89dd..bcea8999 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -752,6 +752,8 @@ static int config_list(uint32_t key, GVariant **data, case SR_CONF_DEVICE_OPTIONS: if (!cg) return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); + if (!devc) + return SR_ERR_ARG; if (cg == devc->digital_group) { *data = std_gvar_array_u32(NULL, 0); return SR_OK;