From a03da1f3cbe369a8c82b8bbda32c2a03b8c4b45d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 17 May 2023 14:07:16 +0200 Subject: broadband-modem: plug leak processing SIM loading steps ==6971== 52 (16 direct, 36 indirect) bytes in 1 blocks are definitely lost in loss record 3,764 of 6,140 ==6971== at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==6971== by 0x4A1ADE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x4A31FF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x4A3266D: g_slice_alloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FD397: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FD8B4: g_error_new_valist (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x49FDACE: g_set_error (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1) ==6971== by 0x187A4C: mm_base_modem_peek_best_at_port (mm-base-modem.c:1129) ==6971== by 0x184116: _at_command (mm-base-modem-at.c:634) ==6971== by 0x1841FE: mm_base_modem_at_command (mm-base-modem-at.c:660) ==6971== by 0x18F6F1: load_sim_identifier (mm-base-sim.c:2016) ==6971== by 0x18CA03: mm_base_sim_load_sim_identifier (mm-base-sim.c:820) --- src/mm-broadband-modem.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index e5a892e4c..c733d938a 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -4220,12 +4220,11 @@ load_sim_step_ready (MMBaseSim *sim, GAsyncResult *res, GTask *task) { - MMBroadbandModem *self; - SimSwapContext *ctx; - - g_autofree gchar *current = NULL; - GError *error = NULL; - const gchar *str; + MMBroadbandModem *self; + SimSwapContext *ctx; + g_autofree gchar *current = NULL; + g_autoptr(GError) error = NULL; + const gchar *str; self = MM_BROADBAND_MODEM (g_task_get_source_object (task)); ctx = g_task_get_task_data (task); @@ -4251,7 +4250,6 @@ load_sim_step_ready (MMBaseSim *sim, mm_obj_warn (self, "could not load SIM %s: %s (%d retries left)", str, error->message, ctx->retries); --ctx->retries; - g_clear_error (&error); if (ctx->step == SIM_SWAP_CHECK_STEP_ICCID_CHANGED) g_timeout_add_seconds (1, (GSourceFunc) load_sim_identifier, task); else if (ctx->step == SIM_SWAP_CHECK_STEP_IMSI_CHANGED) -- cgit v1.2.1