From: Gerhard Sittig Date: Fri, 9 Feb 2018 18:03:06 +0000 (+0100) Subject: hantek-6xxx: fix potential NULL dereference X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e93ca8a4d66a42517a21f6c34bba7cd73dc042d8;p=libsigrok.git hantek-6xxx: fix potential NULL dereference Check pointers' validity before dereferencing. This was reported by clang's scan-build. --- diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index 4e648089..01cba566 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -460,6 +460,8 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg)); break; case SR_CONF_COUPLING: + if (!devc) + return SR_ERR_ARG; *data = g_variant_new_strv(devc->coupling_vals, devc->coupling_tab_size); break; case SR_CONF_VDIV: