Add a check for the case when the parent neighbor may have gone away to avoid using a NULL pointer
This commit is contained in:
parent
0ed7db0f9b
commit
490791eaa4
@ -553,6 +553,9 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
|
|||||||
if(lladdr != NULL) {
|
if(lladdr != NULL) {
|
||||||
/* Add parent in rpl_parents */
|
/* Add parent in rpl_parents */
|
||||||
p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr);
|
p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr);
|
||||||
|
if(p == NULL) {
|
||||||
|
PRINTF("RPL: rpl_add_parent p NULL\n");
|
||||||
|
} else {
|
||||||
p->dag = dag;
|
p->dag = dag;
|
||||||
p->rank = dio->rank;
|
p->rank = dio->rank;
|
||||||
p->dtsn = dio->dtsn;
|
p->dtsn = dio->dtsn;
|
||||||
@ -561,6 +564,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
|
|||||||
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
|
memcpy(&p->mc, &dio->mc, sizeof(p->mc));
|
||||||
#endif /* RPL_DAG_MC != RPL_DAG_MC_NONE */
|
#endif /* RPL_DAG_MC != RPL_DAG_MC_NONE */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user