Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision 3bacee1839e6f355100ab4ea86bb211e9ecf19ed)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 8a1be7692f8710c1044d21f081dc5cffc0d5c33d)
@@ -370,5 +370,7 @@
 
 	/* Allocate a buffer to hold thread IDs */
-	sysarg_t *id_buffer = malloc(buf_size + 1, 0);
+	sysarg_t *id_buffer = malloc(buf_size + 1, FRAME_ATOMIC);
+	if (!id_buffer)
+		return ENOMEM;
 
 	mutex_lock(&TASK->udebug.lock);
@@ -432,5 +434,7 @@
 	size_t name_size = str_size(TASK->name) + 1;
 
-	*data = malloc(name_size, 0);
+	*data = malloc(name_size, FRAME_ATOMIC);
+	if (!*data)
+		return ENOMEM;
 	*data_size = name_size;
 
@@ -472,5 +476,9 @@
 
 	/* Prepare a buffer to hold the arguments. */
-	sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
+	sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), FRAME_ATOMIC);
+	if (!arg_buffer) {
+		_thread_op_end(thread);
+		return ENOMEM;
+	}
 
 	/* Copy to a local buffer before releasing the lock. */
@@ -514,5 +522,9 @@
 
 	/* Prepare a buffer to hold the data. */
-	istate_t *state_buf = malloc(sizeof(istate_t), 0);
+	istate_t *state_buf = malloc(sizeof(istate_t), FRAME_ATOMIC);
+	if (!state_buf) {
+		_thread_op_end(thread);
+		return ENOMEM;
+	}
 
 	/* Copy to the allocated buffer */
@@ -546,5 +558,9 @@
 	}
 
-	void *data_buffer = malloc(n, 0);
+	void *data_buffer = malloc(n, FRAME_ATOMIC);
+	if (!data_buffer) {
+		mutex_unlock(&TASK->udebug.lock);
+		return ENOMEM;
+	}
 
 	/*
