*/
static int rigol_ds_event_wait(const struct sr_dev_inst *sdi, char status1, char status2)
{
- char *buf;
+ char *buf, c;
struct dev_context *devc;
time_t start;
if (sr_scpi_get_string(sdi->conn, ":TRIG:STAT?", &buf) != SR_OK)
return SR_ERR;
- } while (buf[0] == status1 || buf[0] == status2);
+ c = buf[0];
+ g_free(buf);
+ } while (c == status1 || c == status2);
devc->wait_status = 2;
}
if (sr_scpi_get_string(sdi->conn, ":TRIG:STAT?", &buf) != SR_OK)
return SR_ERR;
- } while (buf[0] != status1 && buf[0] != status2);
+ c = buf[0];
+ g_free(buf);
+ } while (c != status1 && c != status2);
rigol_ds_set_wait_event(devc, WAIT_NONE);
}
char *buf;
struct dev_context *devc;
time_t start;
- int len;
+ int len, ret;
if (!(devc = sdi->priv))
return SR_ERR;
/* "READ,nnnn" (still working) or "IDLE,nnnn" (finished) */
if (sr_scpi_get_string(sdi->conn, ":WAV:STAT?", &buf) != SR_OK)
return SR_ERR;
-
- if (parse_int(buf + 5, &len) != SR_OK)
+ ret = parse_int(buf + 5, &len);
+ g_free(buf);
+ if (ret != SR_OK)
return SR_ERR;
} while (buf[0] == 'R' && len < (1000 * 1000));
}
gchar *trig_mode;
unsigned int num_channels, i, j;
int buffer_samples;
+ int ret;
if (!(devc = sdi->priv))
return SR_ERR;
return SR_ERR;
if (sr_scpi_get_string(sdi->conn, ":TRIG:MODE?", &trig_mode) != SR_OK)
return SR_ERR;
- if (rigol_ds_config_set(sdi, ":TRIG:%s:SWE SING", trig_mode) != SR_OK)
+ ret = rigol_ds_config_set(sdi, ":TRIG:%s:SWE SING", trig_mode);
+ g_free(trig_mode);
+ if (ret != SR_OK)
return SR_ERR;
if (rigol_ds_config_set(sdi, ":RUN") != SR_OK)
return SR_ERR;
/* Coupling. */
for (i = 0; i < devc->model->analog_channels; i++) {
cmd = g_strdup_printf(":CHAN%d:COUP?", i + 1);
+ g_free(devc->coupling[i]);
+ devc->coupling[i] = NULL;
res = sr_scpi_get_string(sdi->conn, cmd, &devc->coupling[i]);
g_free(cmd);
if (res != SR_OK)
sr_dbg("CH%d %s", i + 1, devc->coupling[i]);
/* Trigger source. */
+ g_free(devc->trigger_source);
+ devc->trigger_source = NULL;
if (sr_scpi_get_string(sdi->conn, ":TRIG:EDGE:SOUR?", &devc->trigger_source) != SR_OK)
return SR_ERR;
sr_dbg("Current trigger source %s", devc->trigger_source);
sr_dbg("Current horizontal trigger position %g", devc->horiz_triggerpos);
/* Trigger slope. */
+ g_free(devc->trigger_slope);
+ devc->trigger_slope = NULL;
if (sr_scpi_get_string(sdi->conn, ":TRIG:EDGE:SLOP?", &devc->trigger_slope) != SR_OK)
return SR_ERR;
sr_dbg("Current trigger slope %s", devc->trigger_slope);