Free sr_config and sr_config lists in meta datafeeds correctly.

This commit is contained in:
Frank Stettner 2019-02-19 16:57:48 +01:00 committed by Uwe Hermann
parent 7ed4ae6307
commit a0bc8afd7d
5 changed files with 15 additions and 6 deletions

View File

@ -282,9 +282,10 @@ static int send_config_update_key(const struct sr_dev_inst *sdi,
packet.type = SR_DF_META;
packet.payload = &meta;
meta.config = g_slist_append(meta.config, cfg);
meta.config = g_slist_append(NULL, cfg);
ret = sr_session_send(sdi, &packet);
g_slist_free(meta.config);
sr_config_free(cfg);
return ret;

View File

@ -346,7 +346,8 @@ static void process_byte(const struct sr_dev_inst *sdi, const unsigned char c,
g_variant_new_uint64(devc->buf[7] * 1000));
meta.config = g_slist_append(NULL, src);
sr_session_send(sdi, &packet);
g_free(src);
g_slist_free(meta.config);
sr_config_free(src);
devc->buf_len = 0;
}
} else if (devc->state == ST_GET_LOG_RECORD_DATA) {

View File

@ -371,7 +371,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
packet.payload = &meta;
meta.config = g_slist_append(NULL, src);
sr_session_send(sdi, &packet);
g_free(src);
g_slist_free(meta.config);
sr_config_free(src);
}
if (!(devc->xfer = libusb_alloc_transfer(0)))

View File

@ -288,7 +288,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
src = sr_config_new(SR_CONF_SAMPLE_INTERVAL, g_variant_new_uint64(interval));
meta.config = g_slist_append(NULL, src);
sr_session_send(sdi, &packet);
g_free(src);
g_slist_free(meta.config);
sr_config_free(src);
if (devc->logged_samples == 0) {
/* This ensures the frontend knows the session is done. */

View File

@ -255,15 +255,20 @@ static int send_config_update(struct sr_dev_inst *sdi, struct sr_config *cfg)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_meta meta;
int ret;
memset(&meta, 0, sizeof(meta));
packet.type = SR_DF_META;
packet.payload = &meta;
meta.config = g_slist_append(meta.config, cfg);
meta.config = g_slist_append(NULL, cfg);
return sr_session_send(sdi, &packet);
ret = sr_session_send(sdi, &packet);
g_slist_free(meta.config);
return ret;
}
static int send_config_update_key(struct sr_dev_inst *sdi, uint32_t key,