[PATCH] broadband-modem-mbim: implement network scan

Aleksander Morgado aleksander at lanedo.com
Mon Dec 9 04:28:59 PST 2013


On 05/12/13 20:04, Dan Williams wrote:
> +    response = mbim_device_command_finish (device, res, &error);
>> +    if (response &&
>> +        mbim_message_command_done_get_result (response, &error) &&
>> +        mbim_message_visible_providers_response_parse (
>> +            response,
>> +            &n_providers,
>> +            &providers,
>> +            &error)) {
>> +        GList *info_list;
>> +
>> +        info_list = mm_3gpp_network_info_list_from_mbim_providers ((const MbimProvider *const *)providers,
>> +                                                                   n_providers);
>> +        g_simple_async_result_set_op_res_gpointer (simple, info_list, NULL);
>> +        mbim_provider_array_free (providers);
>> +    } else
>> +        g_simple_async_result_take_error (simple, error);
>> +
>> +    if (response)
>> +        mbim_message_unref (response);
>> +    g_simple_async_result_complete (simple);
>> +    g_object_unref (simple);


Same thing here with the info_list set as result in the
GSimpleAsyncResult; it will be leaked if the method is called with a
NULL GAsyncReadyCallback.

In this case, you can always set a full reference to the MbimMessage as
result in the GSimpleAsyncResult, using mbim_message_unref as
GDestroyNotify, and then build the info_list of providers within _finish().


-- 
Aleksander


More information about the ModemManager-devel mailing list