ref: d1001457d857f4c8db216691fc2ecf18febe1912
parent: 68820e2501046b5a7bf5cd4b11091fd91f25f7de
author: mkf <mkf@cloud9p.org>
date: Fri Nov 24 14:08:23 EST 2023
lladd: assign val and next _after_ malloc
--- a/libc/lladd.c
+++ b/libc/lladd.c
@@ -2,18 +2,19 @@
#include <err.h>
#include <mem.h>
+#include <vfs.h>
int
lladd(ll_t *last, void *data)
{
ll_t *temp;
- temp->val = data;
- temp->next = nil;
-
if(last->next != nil)
return LL_ERR;
temp = malloc(sizeof(ll_t*));
+
+ temp->val = data;
+ temp->next = nil;
last->next = temp;
return OK;