diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2024-05-27 00:06:45 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-31 10:46:59 +0000 |
commit | df8287bf6c2febd068d06f0f45194bc622118bd4 (patch) | |
tree | 59c742523f3d86a794684cab50eea167569b01e8 /src/mm-modem-helpers.c | |
parent | bd0551460bc7591329fc17dbec4e160a4a35e812 (diff) |
modem-helpers: do not leak past PDP on error
If CID parsing from the +CGDCONT response fails, the very last PDP
structure allocated is not put on the list yet and therefore
mm_3gpp_pdp_context_list_free() wouldn't free it.
Let's put it on the list first, as to not leak it on error.
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r-- | src/mm-modem-helpers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 8dad5a39..9f0c8a8c 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1870,6 +1870,8 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply, MM3gppPdpContext *pdp; pdp = g_slice_new0 (MM3gppPdpContext); + list = g_list_prepend (list, pdp); + if (!mm_get_uint_from_match_info (match_info, 1, &pdp->cid)) { inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED, @@ -1879,8 +1881,6 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply, } pdp->pdp_type = ip_family; pdp->apn = mm_get_string_unquoted_from_match_info (match_info, 3); - - list = g_list_prepend (list, pdp); } g_free (str); |