From: Gerhard Sittig Date: Thu, 8 Feb 2018 21:44:16 +0000 (+0100) Subject: chronovu-la: avoid NULL pointer dereference X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=755eb221565ae83d8e80e97615b84e2fff4580dd;p=libsigrok.git chronovu-la: avoid NULL pointer dereference Check pointers' validity before dereferencing them. This was reported by clang's scan-build. --- diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 3d19b4f0..8ca68edb 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -351,12 +351,12 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_samplerates(ARRAY_AND_SIZE(devc->samplerates)); break; case SR_CONF_LIMIT_SAMPLES: - if (!devc->prof) + if (!devc || !devc->prof) return SR_ERR_BUG; *data = std_gvar_tuple_u64(0, (devc->prof->model == CHRONOVU_LA8) ? MAX_NUM_SAMPLES : MAX_NUM_SAMPLES / 2); break; case SR_CONF_TRIGGER_MATCH: - if (!devc->prof) + if (!devc || !devc->prof) return SR_ERR_BUG; *data = std_gvar_array_i32(trigger_matches, devc->prof->num_trigger_matches); break;