[PATCH] broadband-modem: fix an ineffective `g_assert (equip_id)'
Aleksander Morgado
aleksander at aleksander.es
Fri Aug 4 13:04:11 UTC 2017
On Thu, Aug 3, 2017 at 11:41 PM, Ben Chan <benchan at chromium.org> wrote:
> 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).
> ---
Pushed to git master, thanks.
> src/mm-broadband-modem.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
> index 2bfc3382..3e30aa90 100644
> --- a/src/mm-broadband-modem.c
> +++ b/src/mm-broadband-modem.c
> @@ -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 */
> }
> --
> 2.14.0.rc1.383.gd1ce394fe2-goog
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list