]> sigrok.org Git - libsigrok.git/commitdiff
Free sr_config and sr_config lists in meta datafeeds correctly.
authorFrank Stettner <redacted>
Tue, 19 Feb 2019 15:57:48 +0000 (16:57 +0100)
committerUwe Hermann <redacted>
Fri, 29 Mar 2019 15:15:37 +0000 (16:15 +0100)
src/hardware/arachnid-labs-re-load-pro/protocol.c
src/hardware/cem-dt-885x/protocol.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/lascar-el-usb/api.c
src/lcr/es51919.c

index 998ba17119113956bd1f3f17a57f9cb19223f0ad..86e317a5cff8eca7c0aef5869bc9b8696105da7e 100644 (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;
index f6e05de9693845aee20dfb30e3508fd3f474b254..0366b29d95b5ac7a0832614dc53a4ce115a06ac2 100644 (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) {
index 2836840446d0842dc433af475da8849fcc1503f6..60b1164d4f8fa5ffd739f1dd48ca841885d86a44 100644 (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)))
index c64882c0bdb9913086bb24cd376b5da2c50e58d6..64753d780dd2162648fde1982146d07d663d97e4 100644 (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. */
index 2dc5e648159aeddeb6fe73370da6e789a77f72e8..b9894a1b439cc7edbe3af2acc6b93f7cfb2bcb29 100644 (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);
+
+       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,