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

This was reported by clang's scan-build.

src/hardware/rigol-ds/api.c

index 443d89ddc7166e95e39e71eefba9b16bcfc376ff..bcea8999e6833b342576e117b6c8e2fd12b512a4 100644 (file)
@@ -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;