/* Get length of buffer required. */
va_copy(args_copy, args);
- len = vsnprintf(NULL, 0, format, args_copy);
+ len = sr_vsnprintf_ascii(NULL, 0, format, args_copy);
va_end(args_copy);
/* Allocate buffer and write out command. */
buf = g_malloc0(len + 2);
- vsprintf(buf, format, args);
+ sr_vsprintf_ascii(buf, format, args);
if (buf[len - 1] != '\n')
buf[len] = '\n';
scpi->free(scpi->priv);
g_free(scpi->priv);
+ g_free(scpi->actual_channel_name);
g_free(scpi);
}
if (channel_cmd && channel_name &&
g_strcmp0(channel_name, scpi->actual_channel_name)) {
sr_spew("sr_scpi_cmd(): new channel = %s", channel_name);
- scpi->actual_channel_name = channel_name;
+ g_free(scpi->actual_channel_name);
+ scpi->actual_channel_name = g_strdup(channel_name);
ret = scpi_send(scpi, channel_cmd, channel_name);
if (ret != SR_OK)
return ret;
if (channel_cmd && channel_name &&
g_strcmp0(channel_name, scpi->actual_channel_name)) {
sr_spew("sr_scpi_cmd_get(): new channel = %s", channel_name);
- scpi->actual_channel_name = channel_name;
+ g_free(scpi->actual_channel_name);
+ scpi->actual_channel_name = g_strdup(channel_name);
ret = scpi_send(scpi, channel_cmd, channel_name);
if (ret != SR_OK)
return ret;