Skip to content

Commit 2c6f30a

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Addede NULL check some of mac neighbor table check.
1 parent ed45fda commit 2c6f30a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ static void neighbor_table_class_remove_entry(mac_neighbor_table_t *table_class,
7979

8080
void mac_neighbor_table_neighbor_list_clean(mac_neighbor_table_t *table_class)
8181
{
82+
if (!table_class) {
83+
return;
84+
}
8285
ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &table_class->neighbour_list) {
8386
neighbor_table_class_remove_entry(table_class, cur);
8487
}
@@ -87,6 +90,9 @@ void mac_neighbor_table_neighbor_list_clean(mac_neighbor_table_t *table_class)
8790

8891
void mac_neighbor_table_neighbor_timeout_update(mac_neighbor_table_t *table_class, uint32_t time_update)
8992
{
93+
if (!table_class) {
94+
return;
95+
}
9096
bool nud_is_enabled = false;
9197
if (table_class->nud_threshold && table_class->user_nud_notify_cb) {
9298
nud_is_enabled = true;
@@ -124,6 +130,9 @@ void mac_neighbor_table_neighbor_timeout_update(mac_neighbor_table_t *table_clas
124130

125131
mac_neighbor_table_entry_t *mac_neighbor_table_entry_allocate(mac_neighbor_table_t *table_class, const uint8_t *mac64)
126132
{
133+
if (!table_class) {
134+
return NULL;
135+
}
127136
mac_neighbor_table_entry_t *entry = ns_list_get_first(&table_class->free_list);
128137
if (!entry) {
129138
return NULL;
@@ -194,6 +203,9 @@ void mac_neighbor_table_trusted_neighbor(mac_neighbor_table_t *table_class, mac_
194203

195204
mac_neighbor_table_entry_t *mac_neighbor_table_address_discover(mac_neighbor_table_t *table_class, const uint8_t *address, uint8_t address_type)
196205
{
206+
if (!table_class) {
207+
return NULL;
208+
}
197209
uint16_t short_address;
198210
if (address_type == 2) {
199211
short_address = common_read_16_bit(address);

0 commit comments

Comments
 (0)