Free results of device scan as soon as possible.
authorBert Vermeulen <bert@biot.com>
Thu, 24 Jul 2014 18:31:55 +0000 (20:31 +0200)
committerBert Vermeulen <bert@biot.com>
Thu, 24 Jul 2014 18:31:55 +0000 (20:31 +0200)
main.c
session.c
show.c

diff --git a/main.c b/main.c
index 95b4258f477f4dc304ebf11fe7e7f52432316ddc..ea4c71846791bd42f20f74aa6d77021fc3475180 100644 (file)
--- a/main.c
+++ b/main.c
@@ -90,6 +90,7 @@ static void set_options(void)
                return;
        }
        sdi = devices->data;
+       g_slist_free(devices);
 
        if (sr_dev_open(sdi) != SR_OK) {
                g_critical("Failed to open device.");
@@ -99,7 +100,6 @@ static void set_options(void)
        set_dev_options(sdi, devargs);
 
        sr_dev_close(sdi);
-       g_slist_free(devices);
        g_hash_table_destroy(devargs);
 
 }
index e8c52d549910de4f0d78a9316229caed744953d5..e5c7d5d24193e4fc2d34a84d485fbaf4a107651e 100644 (file)
--- a/session.c
+++ b/session.c
@@ -481,9 +481,11 @@ void run_session(void)
        }
        if (g_slist_length(devices) > 1) {
                g_critical("sigrok-cli only supports one device for capturing.");
+               g_slist_free(devices);
                return;
        }
        sdi = devices->data;
+       g_slist_free(devices);
 
        sr_session_new(&session);
        sr_session_datafeed_callback_add(session, datafeed_in, NULL);
@@ -598,7 +600,6 @@ void run_session(void)
 
        sr_session_datafeed_callback_remove_all(session);
        sr_session_destroy(session);
-       g_slist_free(devices);
 
 }
 
diff --git a/show.c b/show.c
index 08abf6c184a00f516cd5d5a07b8c8f4d55145a12..e3e9c825758e5f548baa1b7f77a71f9bbb14bb64 100644 (file)
--- a/show.c
+++ b/show.c
@@ -224,6 +224,7 @@ void show_dev_detail(void)
        }
 
        sdi = devices->data;
+       g_slist_free(devices);
        print_dev_line(sdi);
 
        if (sr_dev_open(sdi) != SR_OK) {
@@ -543,7 +544,6 @@ void show_dev_detail(void)
        g_variant_unref(gvar_opts);
 
        sr_dev_close(sdi);
-       g_slist_free(devices);
 
 }