diff --git a/wrapper.c b/wrapper.c
index 4c1639f1536d259a2b64d574005ac973d042b273..79635f2e1628a1ac25d62ca502c9ee4d0a2b61d6 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
try_to_free_t set_try_to_free_routine(try_to_free_t routine)
{
try_to_free_t old = try_to_free_routine;
+ if (!routine)
+ routine = do_nothing;
try_to_free_routine = routine;
return old;
}
void *xmallocz(size_t size)
{
void *ret;
- if (size + 1 < size)
+ if (unsigned_add_overflows(size, 1))
die("Data too large to fit into virtual memory space.");
ret = xmalloc(size + 1);
((char*)ret)[size] = 0;