di was initialized as NULL. If no device covered by this driver
is used, di remains NULL. This causes a segmentation fault when
calling clear_instances().
Check for di being NULL.
Signed-off-by: Alexandru Gagniuc <redacted>
struct dev_context *devc;
GSList *l;
struct dev_context *devc;
GSList *l;
+ /* di is not necessarily initialized */
+ if (!di)
+ return SR_OK;
+
if (!(drvc = di->priv))
return SR_OK;
if (!(drvc = di->priv))
return SR_OK;