From eebd31b92e4e60078911decd87a8c6e658d20cd1 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 23 May 2024 14:54:03 +0200 Subject: [PATCH 03/11] broadband-modem: fix a potential leak in cusd_process_string() error handling On error, *converted may already be allocated and we need to free it (but not in case we're returning it from the task). --- src/mm-broadband-modem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 41906c2e5..b924c3a96 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -6306,9 +6306,10 @@ out: if (error) g_task_return_error (task, error); else if (converted) - g_task_return_pointer (task, converted, g_free); + g_task_return_pointer (task, g_steal_pointer(&converted), g_free); else g_assert_not_reached (); + g_clear_pointer (&converted, g_free); return; } -- 2.45.2