serial: Check event ptr before using.
This avoids a NULL dereference when called twice.
This commit is contained in:
parent
661cc2ec46
commit
2634b77812
|
@ -843,6 +843,9 @@ SR_PRIV int serial_source_remove(struct sr_session *session,
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!serial->event_set)
|
||||
return SR_OK;
|
||||
|
||||
for (i = 0; i < serial->event_set->count; i++)
|
||||
if (sr_session_source_remove_pollfd(session, &serial->pollfds[i]) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
|
Loading…
Reference in New Issue