aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2022-08-04 17:51:34 +0200
committerAleksander Morgado <aleksander@aleksander.es>2022-08-04 17:58:55 +0200
commit4a62ea3e84aaf7690cd327c172efb0cf68f97d34 (patch)
tree72d8fd4c55f978abaababc0d4be41d2568b2fc85
parenta783d9f68af90cdd2b7874273169724c53114646 (diff)
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
-rw-r--r--src/mm-broadband-modem-mbim.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index e8670b0c..39e1f3e3 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -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,