aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2024-02-26 23:30:04 -0600
committerDenis Kenzior <denkenz@gmail.com>2024-02-26 23:31:12 -0600
commit6bf0a2541d43058ca789cd09046a131a430b7cb7 (patch)
treecbb5e18c56c280812bf4480d28ea5fc437cef25b
parenta46dff5b2476b0e679efdde8b5af5a80472846d1 (diff)
downloadofono-6bf0a2541d43058ca789cd09046a131a430b7cb7.tar.gz
lte: Fix invalid cleanup
The intent was to have l_free apply to the settings variable, not the const ap variable. Also, while here, fix dereferencing ap if it is NULL. Fixes: 69adffb51633 ("lte: Add provisioning support")
-rw-r--r--src/lte.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lte.c b/src/lte.c
index 05491c3a1..d6de40849 100644
--- a/src/lte.c
+++ b/src/lte.c
@@ -63,8 +63,8 @@ static bool provision_default_attach_info(struct ofono_lte *lte,
const char *mcc, const char *mnc,
const char *spn)
{
- struct provision_db_entry *settings;
- _auto_(l_free) const struct provision_db_entry *ap = NULL;
+ _auto_(l_free) struct provision_db_entry *settings = NULL;
+ const struct provision_db_entry *ap = NULL;
size_t count;
size_t i;
@@ -83,7 +83,7 @@ static bool provision_default_attach_info(struct ofono_lte *lte,
}
}
- if (!is_valid_apn(ap->apn))
+ if (!ap || !is_valid_apn(ap->apn))
return false;
if (ap->username && strlen(ap->username) >