Commit afe4fc66 authored by Slava Monich's avatar Slava Monich

Merge branch 'fix_1.22' into 'master'

Follow-up to 1.22 update

See merge request mer-core/ofono!235
parents 92aebc3c c04b14c4
......@@ -2768,8 +2768,16 @@ static void sim_free_main_state(struct ofono_sim *sim)
if (sim->impi)
g_free(sim->impi);
if (sim->aid_sessions)
if (sim->aid_list) {
g_slist_free_full(sim->aid_list,
(GDestroyNotify) sim_app_record_free);
sim->aid_list = NULL;
}
if (sim->aid_sessions) {
g_slist_free_full(sim->aid_sessions, aid_session_free);
sim->aid_sessions = NULL;
}
sim->initialized = false;
sim->wait_initialized = false;
......
......@@ -1016,6 +1016,14 @@ void sim_eons_add_pnn_record(struct sim_eons *eons, int record,
int namelength;
struct sim_eons_operator_info *oper = &eons->pnn_list[record-1];
g_free(oper->info);
g_free(oper->shortname);
g_free(oper->longname);
oper->info = NULL;
oper->shortname = NULL;
oper->longname = NULL;
name = ber_tlv_find_by_tag(tlv, 0x43, length, &namelength);
if (name == NULL || !namelength)
......@@ -1549,6 +1557,12 @@ gboolean sim_cphs_is_active(unsigned char *cphs, enum sim_cphs_service index)
return ((cphs[index / 4] >> ((index % 4) * 2)) & 3) == 3;
}
void sim_app_record_free(struct sim_app_record *app)
{
g_free(app->label);
g_free(app);
}
GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len)
{
GSList *ret = NULL;
......@@ -1570,7 +1584,7 @@ GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len)
memcpy(app.aid, aid, app.aid_len);
app.type = (app.aid[5] << 8) & app.aid[6];
app.type = (app.aid[5] << 8) | app.aid[6];
/* Find the label (optional) */
label = ber_tlv_find_by_tag(dataobj, 0x50, dataobj_len,
......
......@@ -517,6 +517,7 @@ gboolean sim_sst_is_active(unsigned char *service_sst, unsigned char len,
gboolean sim_cphs_is_active(unsigned char *service_cphs,
enum sim_cphs_service index);
void sim_app_record_free(struct sim_app_record *app);
GSList *sim_parse_app_template_entries(const unsigned char *buffer, int len);
int sim_build_umts_authenticate(unsigned char *buffer, int len,
......
......@@ -501,6 +501,7 @@ static void test_application_entry_decode(void)
g_assert(!strcmp(app[1]->label, "MIDPfiles"));
g_free(ef_dir);
g_slist_free_full(entries, (GDestroyNotify) sim_app_record_free);
}
static void test_get_3g_path(void)
......
......@@ -111,6 +111,7 @@ static void test_serialize_assembly(void)
&sms.deliver.oaddr, ref, max, seq);
g_assert(l != NULL);
g_slist_free_full(l, g_free);
sms_assembly_free(assembly);
}
......
......@@ -1840,6 +1840,8 @@ static void test_decode_unicode(void)
decoded = sms_decode_text(l);
sms_assembly_free(assembly);
g_assert(strcmp(decoded, "Test 我我") == 0);
g_slist_free_full(l, g_free);
g_free(decoded);
/* contains UTF-16 (a Unicode surrogate pair representing an emoticon) */
pdu = decode_hex(simple_deliver_unicode_surrogate, -1, &pdu_len, 0);
......@@ -1860,6 +1862,8 @@ static void test_decode_unicode(void)
decoded = sms_decode_text(l);
sms_assembly_free(assembly);
g_assert(strcmp(decoded, "Test 😻") == 0);
g_slist_free_full(l, g_free);
g_free(decoded);
}
int main(int argc, char **argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment