plugins: fixed crash in udevng

The return value from ofono_modem_register was not being checked. If this fails
the modem object is not setup and causes a crash. This was specifically seen
when using the mbim driver without having configured with mbim support.

Now the modem object gets destroyed properly if the modem registration fails.
This commit is contained in:
James Prestwood 2018-05-22 13:35:49 -07:00 committed by Denis Kenzior
parent 1a8960564e
commit 34ff57e083
1 changed files with 5 additions and 1 deletions

View File

@ -1802,7 +1802,11 @@ static gboolean create_modem(gpointer key, gpointer value, gpointer user_data)
if (driver_list[i].setup(modem) == TRUE) {
ofono_modem_set_string(modem->modem, "SystemPath",
syspath);
ofono_modem_register(modem->modem);
if (ofono_modem_register(modem->modem) < 0) {
DBG("could not register modem '%s'", modem->driver);
return TRUE;
}
return FALSE;
}
}