Skip to content

Commit 6122d24

Browse files
dereference null value issue fixed. (#1557)
1 parent d1378dc commit 6122d24

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,21 +1920,17 @@ void thread_mcast_group_change(struct protocol_interface_info_entry *interface,
19201920
}
19211921
}
19221922

1923-
void thread_old_partition_data_purge(thread_info_t *thread_info)
1923+
void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur)
19241924
{
1925-
protocol_interface_info_entry_t *cur;
1926-
19271925
/* Partition has been changed. Wipe out data related to old partition */
1928-
thread_management_client_pending_coap_request_kill(thread_info->interface_id);
1926+
thread_management_client_pending_coap_request_kill(cur->id);
19291927

19301928
/* Reset previous routing information */
1931-
thread_routing_reset(&thread_info->routing);
1932-
1933-
/* Clear previous context ID's */
1934-
cur = protocol_stack_interface_info_get_by_id(thread_info->interface_id);
1929+
thread_routing_reset(&cur->thread_info->routing);
19351930

19361931
/* Flush address cache */
19371932
ipv6_neighbour_cache_flush(&cur->ipv6_neighbour_cache);
1933+
19381934
}
19391935

19401936
#endif

source/6LoWPAN/Thread/thread_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ uint8_t thread_pending_timestamp_tlv_size(protocol_interface_info_entry_t *cur);
412412
void thread_calculate_key_guard_timer(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration, bool is_init);
413413
void thread_set_link_local_address(protocol_interface_info_entry_t *cur);
414414
void thread_mcast_group_change(struct protocol_interface_info_entry *interface, struct if_group_entry *group, bool group_added);
415-
void thread_old_partition_data_purge(thread_info_t *thread_info);
415+
void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur);
416416

417417
#else // HAVE_THREAD
418418

source/6LoWPAN/Thread/thread_leader_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ static void thread_leader_service_interface_setup_activate(protocol_interface_in
13171317
thread_leader_service_private_routemask_init(private);
13181318
//SET Router ID
13191319
thread_leader_allocate_router_id_by_allocated_id(private, routerId, cur->mac);
1320-
thread_old_partition_data_purge(cur->thread_info);
1320+
thread_old_partition_data_purge(cur);
13211321
cur->lowpan_address_mode = NET_6LOWPAN_GP16_ADDRESS;
13221322
thread_bootstrap_update_ml16_address(cur, cur->thread_info->routerShortAddress);
13231323
thread_generate_ml64_address(cur);

source/6LoWPAN/Thread/thread_lowpower_api.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ void thread_lowpower_process_response(uint8_t *src_address,int8_t instance_id, u
444444
(void) instance_id;
445445
mle_tlv_info_t linkMetricsReport;
446446
if (memcmp(src_address, data_response_ptr->destination_address, 16) != 0) {
447-
tr_debug("Data response not for me");
448447
return;
449448
}
450449

source/6LoWPAN/Thread/thread_mle_message_handler.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static void thread_parse_advertisement(protocol_interface_info_entry_t *cur, mle
351351
if ((thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) ||
352352
(thread_info(cur)->thread_leader_data->weighting != leaderData.weighting)) {
353353
//parent changed partition/weight - reset own routing information
354-
thread_old_partition_data_purge(cur->thread_info);
354+
thread_old_partition_data_purge(cur);
355355
}
356356
//check if network data needs to be requested
357357
if (!thread_bootstrap_request_network_data(cur, &leaderData, shortAddress)) {
@@ -577,7 +577,7 @@ static void thread_parse_data_response(protocol_interface_info_entry_t *cur, mle
577577
if (thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) {
578578
thread_info(cur)->thread_leader_data->leaderRouterId = leaderData.leaderRouterId;
579579
thread_info(cur)->thread_leader_data->partitionId = leaderData.partitionId;
580-
thread_old_partition_data_purge(cur->thread_info);
580+
thread_old_partition_data_purge(cur);
581581
accept_new_data = true;
582582
}
583583

@@ -716,7 +716,7 @@ static void thread_host_child_update_request_process(protocol_interface_info_ent
716716
if (thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) {
717717
thread_info(cur)->thread_leader_data->leaderRouterId = leaderData.leaderRouterId;
718718
thread_info(cur)->thread_leader_data->partitionId = leaderData.partitionId;
719-
thread_old_partition_data_purge(cur->thread_info);
719+
thread_old_partition_data_purge(cur);
720720
}
721721
//Check Network Data TLV
722722
if (mle_tlv_read_tlv(MLE_TYPE_NETWORK_DATA, mle_msg->data_ptr, mle_msg->data_length, &networkDataTlv)) {

0 commit comments

Comments
 (0)