broadband-modem: fix an ineffective `g_assert (equip_id)'

This patch fixes an ineffective `g_assert (equip_id)' in
modem_load_equipment_identifier_finish(). After mm_parse_gsn() succeeds,
`equip_id' is freed but not reset to NULL, so `g_assert (equip_id)' will
never assert even if `imei', `meid', and `esn' are all NULL (though that
shouldn't happen when mm_parse_gsn() succeeds).
This commit is contained in:
Ben Chan
2017-08-04 15:00:27 +02:00
committed by Aleksander Morgado
parent 0d3cca2c6f
commit 24ed8d3e99
+4 -3
View File
@@ -901,7 +901,7 @@ modem_load_equipment_identifier_finish (MMIfaceModem *self,
/* Modems put all sorts of things into the GSN response; sanitize it */
if (mm_parse_gsn (equip_id, &imei, &meid, &esn)) {
g_free (equip_id);
g_clear_pointer (&equip_id, g_free);
if (imei)
equip_id = g_strdup (imei);
@@ -909,11 +909,12 @@ modem_load_equipment_identifier_finish (MMIfaceModem *self,
equip_id = g_strdup (meid);
else if (esn)
equip_id = g_strdup (esn);
else
g_assert_not_reached ();
g_free (esn);
g_free (meid);
g_free (imei);
g_assert (equip_id);
} else {
/* Leave whatever the modem returned alone */
}