serial: Check event ptr before using.

This avoids a NULL dereference when called twice.
This commit is contained in:
Bert Vermeulen 2015-08-16 20:03:10 +02:00
parent 661cc2ec46
commit 2634b77812
1 changed files with 3 additions and 0 deletions

View File

@ -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;