Skip to content
Snippets Groups Projects
Commit f2664424 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

fix malloc conformance

found by the glibc testsuite
parent 8ca70fa1
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@
#include <new>
#include <boost/utility.hpp>
#include <string.h>
#include "libc/libc.hh"
namespace memory {
......@@ -271,6 +272,9 @@ extern "C" {
void* malloc(size_t size)
{
if ((ssize_t)size < 0)
return libc_error_ptr<void *>(ENOMEM);
if (size <= memory::pool::max_object_size) {
size = std::max(size, memory::pool::min_object_size);
unsigned n = ilog2_roundup(size);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment