[PATCH 2/2] sim7100: fix AT chat leak on PPP open failure
Sean Nyekjaer <[email protected]> Thu, 16 Apr 2026 15:16:48 +0200
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
If opening the PPP channel fails in sim7100_enable(), the previously
opened AT chat instance is not released, resulting in a resource leak.
Fix this by unref'ing the AT chat and clearing the pointer before
returning the error.
---
plugins/sim7100.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 4148e0b2..169b6b47 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -272,8 +272,11 @@ static int sim7100_enable(struct ofono_modem *modem)
return err;
err = open_device(modem, "PPP", &data->ppp);
- if (err < 0)
+ if (err < 0) {
+ g_at_chat_unref(data->at);
+ data->at = NULL;
return err;
+ }
data->init_count = 0;
data->init_cmd = g_at_chat_send(data->at, "AT", NULL,
--
2.52.0