X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fscpi%2Fscpi.c;h=3700478692229e7a78813c4058fe608beac93ab7;hb=3d11872282d2186310a3f8bf8f0c6b887e04be25;hp=82c95bfc7586850c0f8cd232b78c659707e6779f;hpb=1c8901f744999a61f1eff7e7a7a5b21d2ab6019f;p=libsigrok.git diff --git a/src/scpi/scpi.c b/src/scpi/scpi.c index 82c95bfc..37004786 100644 --- a/src/scpi/scpi.c +++ b/src/scpi/scpi.c @@ -587,6 +587,7 @@ SR_PRIV void sr_scpi_free(struct sr_scpi_dev_inst *scpi) scpi->free(scpi->priv); g_free(scpi->priv); + g_free(scpi->actual_channel_name); g_free(scpi); } @@ -1195,7 +1196,8 @@ SR_PRIV int sr_scpi_cmd(const struct sr_dev_inst *sdi, 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; @@ -1239,7 +1241,8 @@ SR_PRIV int sr_scpi_cmd_resp(const struct sr_dev_inst *sdi, 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;