[PATCH] huawei: report an error when ^PREFMODE reports no valid values

Aleksander Morgado aleksander at aleksander.es
Fri Jan 3 03:24:00 PST 2014


On 03/01/14 00:56, Ben Chan wrote:
> This patch fixes mm_huawei_parse_prefmode_test to always report an error when
> returning NULL, which avoid a potential crash when the caller tries to access
> the error.
> ---

Pushed, thanks.

>  plugins/huawei/mm-modem-helpers-huawei.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/plugins/huawei/mm-modem-helpers-huawei.c b/plugins/huawei/mm-modem-helpers-huawei.c
> index 926ca77..07a5697 100644
> --- a/plugins/huawei/mm-modem-helpers-huawei.c
> +++ b/plugins/huawei/mm-modem-helpers-huawei.c
> @@ -341,6 +341,10 @@ mm_huawei_parse_prefmode_test (const gchar *response,
>      /* No value */
>      if (out->len == 0) {
>          g_array_unref (out);
> +        g_set_error (error,
> +                     MM_CORE_ERROR,
> +                     MM_CORE_ERROR_FAILED,
> +                     "^PREFMODE response contains no valid values");
>          return NULL;
>      }
>  
> 


-- 
Aleksander Morgado
http://aleksander.es


More information about the ModemManager-devel mailing list