base-modem: fix segfault when disposing modem
If we have a modem reference around during an ongoing operation but the modem has already been disposed after getting removed from the system, we were trying to iterate a NULL hash table, which led to a crash. https://lists.freedesktop.org/archives/modemmanager-devel/2018-November/006915.html Reported by Sebastien Fabre <sebastien.fabre@sigfox.com>
This commit is contained in:
@@ -959,6 +959,9 @@ mm_base_modem_find_ports (MMBaseModem *self,
|
||||
gpointer value;
|
||||
gpointer key;
|
||||
|
||||
if (!self->priv->ports)
|
||||
return NULL;
|
||||
|
||||
/* We'll iterate the ht of ports, looking for any port which is matches
|
||||
* the compare function */
|
||||
g_hash_table_iter_init (&iter, self->priv->ports);
|
||||
|
||||
Reference in New Issue
Block a user