From 8553dc3623520ff6e96e63cb847d74229043a7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 5 Jun 2025 11:59:03 +0200 Subject: [PATCH] modem-helpers: Don't leak strings when parsing DTMF response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `g_ptr_array_new()` creates an array without a free func, this means we'd leak the strings when the reference count drops to 0. Fixes: 56fe8e7d3 ("modem-helpers: add utility function to split DTMF runs") Signed-off-by: Guido Günther --- src/mm-base-call.c | 1 - src/mm-modem-helpers.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mm-base-call.c b/src/mm-base-call.c index e011c448..bf13bedc 100644 --- a/src/mm-base-call.c +++ b/src/mm-base-call.c @@ -766,7 +766,6 @@ static void send_dtmf_context_free (SendDtmfContext *ctx) { send_dtmf_context_clear_timeout (ctx); - g_ptr_array_foreach (ctx->dtmfs, (GFunc) g_free, NULL); g_ptr_array_free (ctx->dtmfs, TRUE); g_assert (!ctx->saved_error); g_slice_free (SendDtmfContext, ctx); diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 5cbf0836..b3c38feb 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -5895,7 +5895,7 @@ mm_dtmf_split (const gchar *dtmf) const gchar *p = dtmf; GString *cur = NULL; - array = g_ptr_array_new (); + array = g_ptr_array_new_with_free_func (g_free); while (*p) { if (*p == MM_CALL_DTMF_PAUSE_CHAR) {