sr: properly initialize and check on device instance driver field

This commit is contained in:
Bert Vermeulen 2012-07-29 03:01:57 +02:00
parent aee878fa2e
commit e8d3d6c843
2 changed files with 2 additions and 1 deletions

View File

@ -194,6 +194,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
return NULL;
}
sdi->driver = NULL;
sdi->index = index;
sdi->status = status;
sdi->inst_type = -1;

View File

@ -88,7 +88,7 @@ SR_API int sr_session_destroy(void)
static void sr_dev_close(struct sr_dev_inst *sdi)
{
if (sdi->driver->dev_close)
if (sdi->driver && sdi->driver->dev_close)
sdi->driver->dev_close(sdi);
}