chronovu-la: avoid NULL pointer dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.
This commit is contained in:
Gerhard Sittig 2018-02-08 22:44:16 +01:00 committed by Uwe Hermann
parent 05b0cc416f
commit 755eb22156
1 changed files with 2 additions and 2 deletions

View File

@ -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;