/**
* 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);