Skip to content

Commit

Permalink
Clear ga when deleting auth/at entry
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankZRS committed Mar 5, 2024
1 parent 6862a22 commit 23f7822
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/oc_knx_sec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,14 @@ oc_at_delete_entry(size_t device_index, int index)
oc_free_string(&g_at_entries[index].kid);
oc_new_string(&g_at_entries[index].kid, "", 0);

if (g_at_entries[index].ga_len > 0) {
uint64_t *cur_arr = g_at_entries[index].ga;
if (cur_arr) {
free(cur_arr);
}
g_at_entries[index].ga_len = 0;
}

char filename[20];
snprintf(filename, 20, "%s_%d", AT_STORE, index);
oc_storage_erase(filename);
Expand Down Expand Up @@ -1378,7 +1386,6 @@ oc_at_dump_entry(size_t device_index, int entry)
oc_byte_string_len(g_at_entries[entry].osc_id));
oc_rep_i_set_text_string(root, 82, oc_string(g_at_entries[entry].sub));
oc_rep_i_set_text_string(root, 81, oc_string(g_at_entries[entry].kid));

oc_rep_i_set_int_array(root, 777, g_at_entries[entry].ga,
g_at_entries[entry].ga_len);

Expand Down

0 comments on commit 23f7822

Please sign in to comment.