]> sigrok.org Git - libsigrok.git/commitdiff
Fixed a crash when loading a second session file.
authorGareth McMullin <redacted>
Thu, 17 Nov 2011 08:18:46 +0000 (21:18 +1300)
committerGareth McMullin <redacted>
Thu, 17 Nov 2011 08:18:46 +0000 (21:18 +1300)
session_driver.c

index f0b4b0f98529f12a4d857497a05359d08018d71b..b7cd5f14916816064bfa05384ed31bed04bb63a2 100644 (file)
@@ -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);
 
 }