From 5eb3acee0ae1d83305a5120b81a927785a3ff821 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Mon, 19 Jun 2023 23:11:54 +0300 Subject: [PATCH] shared-qmi: fix memory leak in set_supl_server command ctx->supl is allocated in mm_shared_qmi_location_set_supl_server using g_strdup. g_strdup requires to free string when unneeded. The problem could be reproduced using following commands ``` while true; do mmcli -m any --location-set-supl-server="supl.google.com:7276"; mem=$(cat /proc/$(pgrep ModemManager)/statm | awk '{print $6}') echo $(date +"%s"), $mem | tee -a mm-leak.log; done; ``` --- src/mm-shared-qmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index 8b5fcee5..44c1a311 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -4464,6 +4464,7 @@ set_supl_server_context_free (SetSuplServerContext *ctx) g_signal_handler_disconnect (ctx->client, ctx->indication_id); g_object_unref (ctx->client); } + g_free (ctx->supl); g_slice_free (SetSuplServerContext, ctx); }