modem-helpers: Don't leak strings when parsing DTMF response

`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 <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-06-14 16:10:05 -05:00
committed by Dan Williams
parent 38417c6520
commit 8553dc3623
2 changed files with 1 additions and 2 deletions
-1
View File
@@ -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);
+1 -1
View File
@@ -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) {