/*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
*
* Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de>
*
return SR_ERR_ARG;
}
- if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
+ if (!(drvc = g_try_malloc(sizeof(struct drv_context)))) {
sr_err("%sDriver context malloc failed.", prefix);
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
+ drvc->instances = NULL;
di->priv = drvc;
return SR_OK;
GSList *l;
int ret;
- drvc = driver->priv;
+ if (!(drvc = driver->priv))
+ /* Driver was never initialized, nothing to do. */
+ return SR_OK;
+
ret = SR_OK;
for (l = drvc->instances; l; l = l->next) {
/* Log errors, but continue cleaning up the rest. */
if (sdi->conn) {
if (sdi->inst_type == SR_INST_USB)
+#if HAVE_LIBUSB_1_0
sr_usb_dev_inst_free(sdi->conn);
+#else
+ ;
+#endif
else if (sdi->inst_type == SR_INST_SERIAL)
sr_serial_dev_inst_free(sdi->conn);
}