-#include "malloc.h"
+#include "threads/malloc.h"
+#include <debug.h>
+#include <list.h>
#include <stdint.h>
-#include "debug.h"
-#include "lib.h"
-#include "list.h"
-#include "synch.h"
-#include "mmu.h"
-#include "palloc.h"
+#include <stdio.h>
+#include <string.h>
+#include "threads/mmu.h"
+#include "threads/palloc.h"
+#include "threads/synch.h"
/* A simple implementation of malloc().
break;
if (d == descs + desc_cnt)
{
- printk ("malloc: %zu byte allocation too big\n", size);
+ printf ("malloc: %zu byte allocation too big\n", size);
return NULL;
}
struct arena *a = block_to_arena (b);
struct desc *d = a->desc;
+ if (p == NULL)
+ return;
+
lock_acquire (&d->lock);
/* Add block to free list. */