commit ecbc373433bc35ecfc82df270d84dfe218ed46e5
parent 13f9921679d05b092668d4ad27cb608ec5df00ca
Author: Joris Vink <joris@coders.se>
Date: Wed, 1 Mar 2023 16:41:33 +0100
revert some labbing in kore_realloc()
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mem.c b/src/mem.c
@@ -123,10 +123,10 @@ kore_realloc(void *ptr, size_t len)
nptr = mem_alloc(len);
} else {
mem = meminfo(ptr);
- if (len <= mem->len)
+ if (len == mem->len)
return (ptr);
nptr = mem_alloc(len);
- memcpy(nptr, ptr, mem->len);
+ memcpy(nptr, ptr, MIN(len, mem->len));
kore_free_zero(ptr);
}