]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(__posix_memalign): Correct check for size of alignment value.
authorUlrich Drepper <drepper@redhat.com>
Tue, 14 May 2002 21:41:26 +0000 (21:41 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 14 May 2002 21:41:26 +0000 (21:41 +0000)
malloc/malloc.c

index 8279ddaf22e4239e309dd9ec45f5c249d25a8265..db65535e49a4d500da223828692cc5fcea81ea14 100644 (file)
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
    and Doug Lea <dl@cs.oswego.edu>, 1996.
@@ -4899,9 +4899,9 @@ __posix_memalign (void **memptr, size_t alignment, size_t size)
 {
   void *mem;
 
-  /* Test whether the SIZE argument is valid.  It must be a power of
-     two multiple of sizeof (void *).  */
-  if (size % sizeof (void *) != 0 || (size & (size - 1)) != 0)
+  /* Test whether the ALIGNMENT argument is valid.  It must be a power
+     of two multiple of sizeof (void *).  */
+  if (alignment % sizeof (void *) != 0 || (alignment & (alignment - 1)) != 0)
     return EINVAL;
 
   mem = __libc_memalign (alignment, size);