serial-dmm: Fix segfault when no device is used
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 <mr.nuke.me@gmail.com>
This commit is contained in:
parent
63c07e48c6
commit
26be4ebef3
|
@ -151,6 +151,10 @@ static int clear_instances(void)
|
|||
struct dev_context *devc;
|
||||
GSList *l;
|
||||
|
||||
/* di is not necessarily initialized */
|
||||
if (!di)
|
||||
return SR_OK;
|
||||
|
||||
if (!(drvc = di->priv))
|
||||
return SR_OK;
|
||||
|
||||
|
|
Loading…
Reference in New Issue