diff --git a/base-nova/src/base/env/cap_sel_alloc.cc b/base-nova/src/base/env/cap_sel_alloc.cc index 7048ddf48c..0d5f822c34 100644 --- a/base-nova/src/base/env/cap_sel_alloc.cc +++ b/base-nova/src/base/env/cap_sel_alloc.cc @@ -36,18 +36,15 @@ static Genode::Lock *alloc_lock() addr_t Cap_selector_allocator::alloc(size_t num_caps_log2) { - alloc_lock()->lock(); - addr_t ret_base = Bit_allocator::alloc(num_caps_log2); - alloc_lock()->unlock(); - return ret_base; + Lock::Guard(alloc_lock()); + return Bit_allocator::alloc(num_caps_log2); } void Cap_selector_allocator::free(addr_t cap, size_t num_caps_log2) { - alloc_lock()->lock(); + Lock::Guard(alloc_lock()); Bit_allocator::free(cap, num_caps_log2); - alloc_lock()->unlock(); }