Remove an assignment that won't take effect. Check pointers' validity
before dereferencing. Fix a memory leak.
This was reported by clang's scan-build.
model = devc->model_config;
state = devc->model_state;
- ret = SR_ERR_NA;
-
switch (key) {
case SR_CONF_LIMIT_FRAMES:
devc->frame_limit = g_variant_get_uint64(data);
*data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog));
break;
case SR_CONF_COUPLING:
+ if (!model)
+ return SR_ERR_ARG;
*data = g_variant_new_strv(*model->coupling_options, model->num_coupling_options);
break;
case SR_CONF_TRIGGER_SOURCE:
return SR_ERR;
if (analog.num_samples == 0) {
+ g_free(analog.data);
+
/* No data available, we have to acquire data first. */
g_snprintf(command, sizeof(command), "ARM;WAIT;*OPC;C%d:WAVEFORM?", ch->index + 1);
sr_scpi_send(sdi->conn, command);