diff mbox series

qmimodem: Fix error path memory leak in gobi

Message ID 20240507153408.681340-1-steve.schrock@getcruise.com (mailing list archive)
State Accepted
Commit d5d99ff503551d5f55aa1ead4d415d182cf44e12
Headers show
Series qmimodem: Fix error path memory leak in gobi | expand

Commit Message

Steve Schrock May 7, 2024, 3:33 p.m. UTC
I noticed this leak when I terminated ofonod while gobi was retrying
discovery on an unresponsive QMUX device.

==8257== 20 (16 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 154
==8257==    at 0x4885118: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
==8257==    by 0x5A4737: l_malloc (util.c:49)
==8257==    by 0x4669E3: qmi_param_new (qmi.c:2374)
==8257==    by 0x466D73: qmi_param_new_uint8 (qmi.c:2449)
==8257==    by 0x47D717: gobi_disable (gobi.c:482)
==8257==    by 0x51BAD7: set_powered (modem.c:986)
==8257==    by 0x51E8FB: __ofono_modem_shutdown (modem.c:2279)
==8257==    by 0x518233: signal_handler (main.c:85)
==8257==    by 0x496D14F: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
==8257==    by 0x49CDE47: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
==8257==    by 0x496DBFF: g_main_loop_run (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
==8257==    by 0x518A23: main (main.c:314)
---
 plugins/gobi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+ofono@kernel.org May 7, 2024, 4:30 p.m. UTC | #1
Hello:

This patch was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Tue,  7 May 2024 10:33:58 -0500 you wrote:
> I noticed this leak when I terminated ofonod while gobi was retrying
> discovery on an unresponsive QMUX device.
> 
> ==8257== 20 (16 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 154
> ==8257==    at 0x4885118: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
> ==8257==    by 0x5A4737: l_malloc (util.c:49)
> ==8257==    by 0x4669E3: qmi_param_new (qmi.c:2374)
> ==8257==    by 0x466D73: qmi_param_new_uint8 (qmi.c:2449)
> ==8257==    by 0x47D717: gobi_disable (gobi.c:482)
> ==8257==    by 0x51BAD7: set_powered (modem.c:986)
> ==8257==    by 0x51E8FB: __ofono_modem_shutdown (modem.c:2279)
> ==8257==    by 0x518233: signal_handler (main.c:85)
> ==8257==    by 0x496D14F: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
> ==8257==    by 0x49CDE47: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
> ==8257==    by 0x496DBFF: g_main_loop_run (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0)
> ==8257==    by 0x518A23: main (main.c:314)
> 
> [...]

Here is the summary with links:
  - qmimodem: Fix error path memory leak in gobi
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=d5d99ff50355

You are awesome, thank you!
diff mbox series

Patch

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 39c1ab81fa56..8bd2c4060446 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -488,6 +488,7 @@  static int gobi_disable(struct ofono_modem *modem)
 					power_disable_cb, modem, NULL) > 0)
 		return -EINPROGRESS;
 
+	qmi_param_free(param);
 out:
 	shutdown_device(modem);