lecroy-xstream: fix several compiler warnings (assignment, memory)
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.
This commit is contained in:
parent
b65adcedb8
commit
f62c2ad65d
|
@ -213,8 +213,6 @@ static int config_set(uint32_t key, GVariant *data,
|
|||
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);
|
||||
|
@ -324,6 +322,8 @@ static int config_list(uint32_t key, GVariant **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:
|
||||
|
|
|
@ -665,6 +665,8 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue