summaryrefslogtreecommitdiff
path: root/src/user/knob/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/knob/block.c')
-rw-r--r--src/user/knob/block.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/user/knob/block.c b/src/user/knob/block.c
index 5b4590f..9f3f353 100644
--- a/src/user/knob/block.c
+++ b/src/user/knob/block.c
@@ -1,6 +1,7 @@
+#include <knob/panic.h>
+#include <knob/heap.h>
#include <stdbool.h>
#include <stdint.h>
-#include <knob/heap.h>
//unsophisticated, should copy by dwords where available
void blockcpy(void *to, const void *from, uint32_t size) {
@@ -31,6 +32,8 @@ char *strdup(const char *from) {
while (*(end++))
;
char *buf = get_block(end - from);
+ if (!buf)
+ PANIC("get_block returned 0 in strdup");
blockcpy(buf, from, end - from);
return buf;
}