Index: mod/kcore/testbin.exe.c ================================================================== --- mod/kcore/testbin.exe.c +++ mod/kcore/testbin.exe.c @@ -28,7 +28,14 @@ void* region = alloc.raw; kmzero(region,2048); if (kmheapf(region) >= kmcond_fail) return kbad_mem; + void* top = kmlini(); + kmres rst = kmlina(1230); + if(rst.cond != kmcond_ok) return kbad_mem; + + kmres rst2 = kmlina(789); + if(rst2.cond != kmcond_ok) return kbad_mem; + return kbad_ok; } Index: mod/kmem/heapf.fn.c ================================================================== --- mod/kmem/heapf.fn.c +++ mod/kmem/heapf.fn.c @@ -35,11 +35,11 @@ * (ptr - sizeof sz). see kmheap.c for details. */ k_platform_syscall_arg args[] = { (sz)header, total }; struct k_platform_syscall_answer r = k_platform_syscall (k_platform_syscall_munmap, Kmsz(args), args); - if(r.error==0) { + if(r.error!=0) { /* we don't need to bother recovering the error * code, there's only one possible munmap error */ return kmcond_bad_address; }