base: avoid null pointer warnings

warning: Called C++ object pointer is null

Issue #3022
This commit is contained in:
Alexander Boettcher 2018-10-25 12:03:02 +02:00 committed by Christian Helmuth
parent 17f7147ac1
commit fc0dbc3f70
3 changed files with 14 additions and 3 deletions

View File

@ -512,8 +512,13 @@ void Region_map_component::detach(Local_addr local_addr)
"the beginning of the region ", Hex(region_ptr->base()));
Dataspace_component *dsc = region_ptr->dataspace();
if (!dsc && _diag.enabled)
warning("detach: region of ", this, " may be inconsistent!");
if (!dsc) {
if (_diag.enabled)
warning("detach: region of ", this, " may be inconsistent!");
return;
}
/* inform dataspace about detachment */
dsc->detached_from(region_ptr);

View File

@ -49,6 +49,11 @@ void Avl_node_base::_rotate_subtree(Avl_node_base *node, Side side, Policy &poli
Avl_node_base *node_r = node->_child[!side];
Avl_node_base *node_r_l = node_r->_child[side];
if (!node_r) {
error("avl rotation node_r is invalid");
return;
}
/* simple rotation */
if (node_r->_bias() == !side) {

View File

@ -98,7 +98,8 @@ void Cancelable_lock::lock()
if (!applicants)
_last_applicant = &myself;
} else {
_last_applicant->applicant_to_wake_up(&myself);
if (_last_applicant)
_last_applicant->applicant_to_wake_up(&myself);
_last_applicant = &myself;
}