malloc: Add warning if free() called on invalid memory

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/src/malloc.c b/src/malloc.c
index c41a0cb..f5c2ed4 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -276,6 +276,16 @@
     return 0;
 }
 
+void
+free(void *data)
+{
+    if (!data)
+        return;
+    int ret = _free(data);
+    if (ret)
+        warn_internalerror();
+}
+
 // Find the amount of free space in a given zone.
 u32
 malloc_getspace(struct zone_s *zone)
diff --git a/src/malloc.h b/src/malloc.h
index 2bcb5bf..b765bc4 100644
--- a/src/malloc.h
+++ b/src/malloc.h
@@ -17,6 +17,7 @@
 void malloc_prepboot(void);
 void *_malloc(struct zone_s *zone, u32 size, u32 align);
 int _free(void *data);
+void free(void *data);
 u32 malloc_getspace(struct zone_s *zone);
 void malloc_sethandle(void *data, u32 handle);
 void *malloc_findhandle(u32 handle);
@@ -64,8 +65,5 @@
         return ret;
     return memalign_tmplow(align, size);
 }
-static inline void free(void *data) {
-    _free(data);
-}
 
 #endif // malloc.h