-
- /* TODO: Error handling. */
-
- /* Properly close all devices... */
- for (l = device_instances; l; l = l->next)
- close_device((struct sr_device_instance *)l->data);
-
- /* ...and free all their memory. */
- for (l = device_instances; l; l = l->next)
- g_free(l->data);
- g_slist_free(device_instances);
- device_instances = NULL;
+ struct sr_dev_inst *sdi;
+
+ for (l = dev_insts; l; l = l->next) {
+ sdi = l->data;
+ /* Properly close all devices... */
+ close_dev(sdi);
+ /* ...and free all their memory. */
+ sr_dev_inst_free(sdi);
+ }
+ g_slist_free(dev_insts);
+ dev_insts = NULL;