From: Gareth McMullin Date: Thu, 17 Nov 2011 08:18:46 +0000 (+1300) Subject: Fixed a crash when loading a second session file. X-Git-Tag: libsigrok-0.1.0~229 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=805e9640ff4a28dc470afb0b4f3b02aece44179b;p=libsigrok.git Fixed a crash when loading a second session file. --- diff --git a/session_driver.c b/session_driver.c index f0b4b0f9..b7cd5f14 100644 --- a/session_driver.c +++ b/session_driver.c @@ -119,9 +119,11 @@ static int feed_chunk(int fd, int revents, void *session_data) } /* driver callbacks */ +static void hw_cleanup(void); static int hw_init(const char *deviceinfo) { + hw_cleanup(); sessionfile = g_strdup(deviceinfo); @@ -135,6 +137,11 @@ static void hw_cleanup(void) for (l = device_instances; l; l = l->next) sr_device_instance_free(l->data); + g_slist_free(device_instances); + device_instances = NULL; + + sr_session_source_remove(-1); + g_free(sessionfile); }