diff
--- a/code.c
+++ b/code.c
@@ -36,6 +36,9 @@
 34 		pool->areas = kcalloc(nareas, sizeof(*pool->areas),
 36 		if (!pool->areas) {
 46 		mem->force_bounce = true;
+47 			kfree(pool->slots); // Free slots if areas allocation fails
+48 			kfree(mem); // Free mem
+49 			return -ENOMEM; // Return an error
 49 		spin_lock_init(&mem->lock);

