Index: kernel/generic/src/cap/cap.c
===================================================================
--- kernel/generic/src/cap/cap.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
+++ kernel/generic/src/cap/cap.c	(revision 74a2a2dd5a514e8b4e53569250bf8f7dbee84d26)
@@ -257,11 +257,11 @@
  * @param task  Task for which to allocate the new capability.
  *
- * @return New capability handle on success.
+ * @param[out] handle  New capability handle on success.
+ *
  * @return Negative error code in case of error.
  */
-cap_handle_t cap_alloc(task_t *task)
+int cap_alloc(task_t *task, cap_handle_t *handle)
 {
 	cap_t *cap = NULL;
-	cap_handle_t handle;
 
 	/*
@@ -293,8 +293,8 @@
 
 	cap->state = CAP_STATE_ALLOCATED;
-	handle = cap->handle;
-	mutex_unlock(&task->cap_info->lock);
-
-	return handle;
+	*handle = cap->handle;
+	mutex_unlock(&task->cap_info->lock);
+
+	return EOK;
 }
 
