broadband-modem-mbim: SIM slots ptr array should have GDestroyNotify
The SIM slots ptr array should have a proper GDestroyNotify, so that whenever the array is unref-ed as part of the modem disposal logic, the SIM objects (and the modem object references they keep) are also unref-ed. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/571
This commit is contained in:
@@ -8405,6 +8405,13 @@ load_sim_slots_context_free (LoadSimSlotsContext *ctx)
|
||||
g_slice_free (LoadSimSlotsContext, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sim_slot_free (MMBaseSim *sim)
|
||||
{
|
||||
if (sim)
|
||||
g_object_unref (sim);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_sim_slots_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
@@ -8632,7 +8639,7 @@ query_sys_caps_ready (MbimDevice *device,
|
||||
return;
|
||||
}
|
||||
ctx->number_slots = number_slots;
|
||||
ctx->sim_slots = g_ptr_array_new_full (number_slots, NULL);
|
||||
ctx->sim_slots = g_ptr_array_new_full (number_slots, (GDestroyNotify) sim_slot_free);
|
||||
|
||||
if (number_executors == 0) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
|
||||
|
Reference in New Issue
Block a user