ModemManager/0003-broadband-modem-fix-a-potential-leak-in-cusd_process.patch
Lubomir Rintel 471d385cd1 Add patches for a couple of bugs that make static analysis unhappy
Real bugs, but no security implications. Let's check the boxes and fix
them, to reduce the static analysis tooling noise.

Resolves: https://issues.redhat.com/browse/RHEL-38991
2024-06-25 10:52:15 +02:00

32 lines
1023 B
Diff

From eebd31b92e4e60078911decd87a8c6e658d20cd1 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
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