From: Bert Vermeulen Date: Thu, 24 Jul 2014 18:31:55 +0000 (+0200) Subject: Free results of device scan as soon as possible. X-Git-Tag: sigrok-cli-0.6.0~86 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b4eece7c5f666690fdbe1923cd3bdc7cf9425d98;p=sigrok-cli.git Free results of device scan as soon as possible. --- diff --git a/main.c b/main.c index 95b4258..ea4c718 100644 --- 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); } diff --git a/session.c b/session.c index e8c52d5..e5c7d5d 100644 --- 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 08abf6c..e3e9c82 100644 --- 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); }