NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/37943: posix_memalign doesn't work



The following reply was made to PR lib/37943; it has been noted by GNATS.

From: Magnus Henoch <mange%freemail.hu@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/37943: posix_memalign doesn't work
Date: Sun, 03 Feb 2008 06:37:30 +0100

 This patch seems to fix the problem, in that it makes my example (and
 glib-genmarshal) not segfault; I'm unable to verify that it always gives
 correct alignment.
 
 --- malloc.c.~1.51.~   Wed Dec 12 23:53:48 2007
 +++ malloc.c   Sun Feb  3 06:35:07 2008
 @@ -1215,11 +1215,11 @@
            return EINVAL;
  
      /* 
 -     * (size & alignment) is enough to assure the requested alignment, since
 +     * (size | alignment) is enough to assure the requested alignment, since
       * the allocator always allocates power-of-two blocks.
       */
      err = errno; /* Protect errno against changes in pubrealloc(). */
 -    result = pubrealloc(NULL, (size & alignment), " in posix_memalign()");
 +    result = pubrealloc(NULL, (size | alignment), " in posix_memalign()");
      errno = err;
  
      if (result == NULL)
 



Home | Main Index | Thread Index | Old Index