svn commit: r197127 - in stable/8/lib/libc: . stdio stdlib stdtime
string
Konstantin Belousov
kib at FreeBSD.org
Sat Sep 12 18:16:46 UTC 2009
Author: kib
Date: Sat Sep 12 18:16:46 2009
New Revision: 197127
URL: http://svn.freebsd.org/changeset/base/197127
Log:
MFC r196861:
Handle zero size for posix_memalign. Return NULL or unique address
according to the 'V' option.
Approved by: re (kensmith)
Modified:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdio/asprintf.c (props changed)
stable/8/lib/libc/stdlib/malloc.c
stable/8/lib/libc/stdtime/ (props changed)
stable/8/lib/libc/string/ffsll.c (props changed)
stable/8/lib/libc/string/flsll.c (props changed)
stable/8/lib/libc/string/wcpcpy.c (props changed)
stable/8/lib/libc/string/wcpncpy.c (props changed)
Modified: stable/8/lib/libc/stdlib/malloc.c
==============================================================================
--- stable/8/lib/libc/stdlib/malloc.c Sat Sep 12 18:11:48 2009 (r197126)
+++ stable/8/lib/libc/stdlib/malloc.c Sat Sep 12 18:16:46 2009 (r197127)
@@ -5320,6 +5320,15 @@ posix_memalign(void **memptr, size_t ali
goto RETURN;
}
+ if (size == 0) {
+ if (opt_sysv == false)
+ size = 1;
+ else {
+ result = NULL;
+ ret = 0;
+ goto RETURN;
+ }
+ }
result = ipalloc(alignment, size);
}
More information about the svn-src-stable-8
mailing list