[PATCH 3/3] sim-mbim: prevent potential leak when loading SIM idenitifier and IMSI
Aleksander Morgado
aleksander at lanedo.com
Tue Dec 10 01:29:25 PST 2013
On 10/12/13 00:07, Ben Chan wrote:
> This patch addresses a potential memory leak when load_sim_identifier or
> load_imsi in MMSimMbim is called but the caller does not provide a
> GAsyncReadyCallback.
> ---
Pushed, thanks!
> src/mm-sim-mbim.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/mm-sim-mbim.c b/src/mm-sim-mbim.c
> index c083997..62bd082 100644
> --- a/src/mm-sim-mbim.c
> +++ b/src/mm-sim-mbim.c
> @@ -73,7 +73,7 @@ load_sim_identifier_finish (MMSim *self,
> {
> if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
> return NULL;
> - return (gchar *)g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
> + return g_strdup ((gchar *)g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
> }
>
> static void
> @@ -97,7 +97,7 @@ simid_subscriber_ready_state_ready (MbimDevice *device,
> NULL, /* telephone_numbers_count */
> NULL, /* telephone_numbers */
> &error))
> - g_simple_async_result_set_op_res_gpointer (simple, sim_iccid, NULL);
> + g_simple_async_result_set_op_res_gpointer (simple, sim_iccid, (GDestroyNotify)g_free);
> else
> g_simple_async_result_take_error (simple, error);
>
> @@ -141,7 +141,7 @@ load_imsi_finish (MMSim *self,
> {
> if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
> return NULL;
> - return (gchar *)g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
> + return g_strdup ((gchar *)g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
> }
>
> static void
> @@ -165,7 +165,7 @@ imsi_subscriber_ready_state_ready (MbimDevice *device,
> NULL, /* telephone_numbers_count */
> NULL, /* telephone_numbers */
> &error))
> - g_simple_async_result_set_op_res_gpointer (simple, subscriber_id, NULL);
> + g_simple_async_result_set_op_res_gpointer (simple, subscriber_id, (GDestroyNotify)g_free);
> else
> g_simple_async_result_take_error (simple, error);
>
>
--
Aleksander
More information about the ModemManager-devel
mailing list