Sorry, my mail client was being stupid. Lets try again in good old mutt:

diff --git a/stdlib/malloc.c b/stdlib/malloc.c
index bc328d2..aa6f0a3 100644
--- a/stdlib/malloc.c
+++ b/stdlib/malloc.c
@@ -1224,8 +1224,9 @@ malloc(size_t size)
        r = omalloc(d, size, 0, CALLER);
        d->active--;
        _MALLOC_UNLOCK();
-       if (r == NULL && mopts.malloc_xmalloc) {
-               wrterror(d, "out of memory", NULL);
+       if (r == NULL) {
+               if (mopts.malloc_xmalloc)
+                       wrterror(d, "out of memory", NULL);
                errno = ENOMEM;
        }
        if (r != NULL)
@@ -1510,8 +1511,9 @@ realloc(void *ptr, size_t size)
 
        d->active--;
        _MALLOC_UNLOCK();
-       if (r == NULL && mopts.malloc_xmalloc) {
-               wrterror(d, "out of memory", NULL);
+       if (r == NULL) {
+               if (mopts.malloc_xmalloc)
+                       wrterror(d, "out of memory", NULL);
                errno = ENOMEM;
        }
        if (r != NULL)
@@ -1563,8 +1565,9 @@ calloc(size_t nmemb, size_t size)
 
        d->active--;
        _MALLOC_UNLOCK();
-       if (r == NULL && mopts.malloc_xmalloc) {
-               wrterror(d, "out of memory", NULL);
+       if (r == NULL) {
+               if (mopts.malloc_xmalloc)
+                       wrterror(d, "out of memory", NULL);
                errno = ENOMEM;
        }
        if (r != NULL)
@@ -1694,10 +1697,9 @@ posix_memalign(void **memptr, size_t alignment, size_t 
size)
        d->active--;
        _MALLOC_UNLOCK();
        if (r == NULL) {
-               if (mopts.malloc_xmalloc) {
+               if (mopts.malloc_xmalloc)
                        wrterror(d, "out of memory", NULL);
-                       errno = ENOMEM;
-               }
+               errno = ENOMEM;
                goto err;
        }
        errno = saved_errno;

Reply via email to