From: Frank Stettner Date: Tue, 19 Feb 2019 15:57:48 +0000 (+0100) Subject: Free sr_config and sr_config lists in meta datafeeds correctly. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a0bc8afd7d7bac81f14b232703ac0a29a7f77e29;p=libsigrok.git Free sr_config and sr_config lists in meta datafeeds correctly. --- diff --git a/src/hardware/arachnid-labs-re-load-pro/protocol.c b/src/hardware/arachnid-labs-re-load-pro/protocol.c index 998ba171..86e317a5 100644 --- a/src/hardware/arachnid-labs-re-load-pro/protocol.c +++ b/src/hardware/arachnid-labs-re-load-pro/protocol.c @@ -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; diff --git a/src/hardware/cem-dt-885x/protocol.c b/src/hardware/cem-dt-885x/protocol.c index f6e05de9..0366b29d 100644 --- a/src/hardware/cem-dt-885x/protocol.c +++ b/src/hardware/cem-dt-885x/protocol.c @@ -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) { diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 28368404..60b1164d 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -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))) diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index c64882c0..64753d78 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -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. */ diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index 2dc5e648..b9894a1b 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -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); + + ret = sr_session_send(sdi, &packet); - return 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,