Re-upload attachment with plain-text mode
From a7e46cb115fae7d4de1cedddb0cbf2932b9ddf39 Mon Sep 17 00:00:00 2001 From: Kito Cheng <kito.ch...@gmail.com> Date: Thu, 23 Feb 2017 17:16:28 +0800 Subject: [PATCH] Only set *memptr when success for posix_memalign
--- libc/stdlib/posix_memalign.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libc/stdlib/posix_memalign.c b/libc/stdlib/posix_memalign.c index 523bc2c..0183107 100644 --- a/libc/stdlib/posix_memalign.c +++ b/libc/stdlib/posix_memalign.c @@ -34,8 +34,10 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) || alignment == 0 */ return EINVAL; - - *memptr = memalign(alignment, size); - - return (*memptr != NULL ? 0 : ENOMEM); + void *mem = memalign(alignment, size); + if (mem != NULL) { + *memptr = mem; + return 0; + } else + return ENOMEM; } -- 2.8.2
_______________________________________________ devel mailing list devel@uclibc-ng.org https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel