Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 core/mempool.cc           | 2 +-
 tests/tst-small-malloc.cc | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/mempool.cc b/core/mempool.cc
index 23dc67da..102e4e6e 100644
--- a/core/mempool.cc
+++ b/core/mempool.cc
@@ -1547,7 +1547,7 @@ static inline void* std_malloc(size_t size, size_t 
alignment)
         return libc_error_ptr<void *>(ENOMEM);
     void *ret;
     size_t minimum_size = std::max(size, memory::pool::min_object_size);
-    if (minimum_size <= memory::pool::max_object_size && alignment <= 
minimum_size && smp_allocator) {
+    if (size <= memory::pool::max_object_size && alignment <= minimum_size && 
smp_allocator) {
         unsigned n = ilog2_roundup(minimum_size);
         ret = memory::malloc_pools[n].alloc();
         ret = translate_mem_area(mmu::mem_area::main, mmu::mem_area::mempool,
diff --git a/tests/tst-small-malloc.cc b/tests/tst-small-malloc.cc
index 7c826fa7..6a086c58 100644
--- a/tests/tst-small-malloc.cc
+++ b/tests/tst-small-malloc.cc
@@ -12,13 +12,13 @@
 void test_malloc(size_t size) {
     void *addr = malloc(size);
     assert(addr);
-    free(addr);
+    assert(reinterpret_cast<uintptr_t>(addr) % 8 == 0);
 }
 
 void test_aligned_alloc(size_t alignment, size_t size) {
     void *addr = aligned_alloc(alignment, size);
     assert(addr);
-    free(addr);
+    assert(reinterpret_cast<uintptr_t>(addr) % alignment == 0);
 }
 
 int main() {
-- 
2.19.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to