Skip to content

Commit

Permalink
Merge branch 'fix_1.22' into 'master'
Browse files Browse the repository at this point in the history
Follow-up to 1.22 update

See merge request mer-core/ofono!235
  • Loading branch information
monich committed Sep 24, 2019
2 parents 92aebc3 + c04b14c commit afe4fc6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ofono/src/sim.c
Expand Up @@ -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;
Expand Down
16 changes: 15 additions & 1 deletion ofono/src/simutil.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions ofono/src/simutil.h
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions ofono/unit/test-simutil.c
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions ofono/unit/test-sms-root.c
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions ofono/unit/test-sms.c
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit afe4fc6

Please sign in to comment.