- /* Properly close and free all devices. */
- for (l = dev_insts; l; l = l->next) {
- if (!(sdi = l->data)) {
- /* Log error, but continue cleaning up the rest. */
- sr_err("hantek-dso: %s: sdi was NULL, continuing", __func__);
- continue;
- }
- if (!(ctx = sdi->priv)) {
- /* Log error, but continue cleaning up the rest. */
- sr_err("hantek-dso: %s: sdi->priv was NULL, continuing", __func__);
- continue;
- }
- dso_close(sdi);
- sr_usb_dev_inst_free(ctx->usb);
- g_free(ctx->triggersource);
-
- sr_dev_inst_free(sdi);
- }
-
- g_slist_free(dev_insts);
- dev_insts = NULL;