/**
* Free device instance struct created by sr_dev_inst().
*
- * @param sdi Device instance to free. Must not be NULL.
+ * @param sdi Device instance to free. If NULL, the function will do nothing.
*
* @private
*/
struct sr_channel_group *cg;
GSList *l;
+ if (!sdi)
+ return;
+
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
g_free(ch->name);
if (serial)
sr_serial_dev_inst_free(serial);
g_free(devc);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
return NULL;
}
fail:
if (hw_info)
sr_scpi_hw_info_free(hw_info);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
g_free(devc);
return NULL;
fail:
sr_scpi_hw_info_free(hw_info);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
g_free(devc);
return NULL;
sr_serial_dev_inst_free(serial);
}
g_free(devc);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
return NULL;
}
fail:
if (hw_info)
sr_scpi_hw_info_free(hw_info);
-
- if (sdi)
- sr_dev_inst_free(sdi);
-
+ sr_dev_inst_free(sdi);
g_free(devc);
return NULL;
}
fail:
if (hw_info)
sr_scpi_hw_info_free(hw_info);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
g_free(devc);
return NULL;
if (in->module->cleanup)
in->module->cleanup((struct sr_input *)in);
- if (in->sdi)
- sr_dev_inst_free(in->sdi);
+ sr_dev_inst_free(in->sdi);
if (in->buf->len > 64) {
/* That seems more than just some sub-unitsize leftover... */
sr_warn("Found %" G_GSIZE_FORMAT
scan_cleanup:
es51919_serial_clean(devc);
- if (sdi)
- sr_dev_inst_free(sdi);
+ sr_dev_inst_free(sdi);
if (serial)
sr_serial_dev_inst_free(serial);