aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-03 20:08:16 +0000
committerDavid Robillard <d@drobilla.net>2013-02-03 20:08:16 +0000
commit541c97ad49dd8bb33297a14f422299328b7f4131 (patch)
tree0cdc5c190af3d753f8b53499044ad056d2014820
parent2de072c67cdd39c45abf452b7c3a7ce73004370f (diff)
downloadserd-541c97ad49dd8bb33297a14f422299328b7f4131.tar.gz
serd-541c97ad49dd8bb33297a14f422299328b7f4131.tar.bz2
serd-541c97ad49dd8bb33297a14f422299328b7f4131.zip
Correctly handle posix_memalign failure
git-svn-id: http://svn.drobilla.net/serd/trunk@411 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r--NEWS3
-rw-r--r--src/serd_internal.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 5a8245c5..f8ecf659 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
serd (0.18.3) unstable;
* Fix possible crash in serd_writer_end_anon() when writing invalid lists
+ * Correctly handle posix_memalign failure
- -- David Robillard <d@drobilla.net> Mon, 21 Jan 2013 22:03:07 -0500
+ -- David Robillard <d@drobilla.net> Sun, 03 Feb 2013 15:07:53 -0500
serd (0.18.2) stable;
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 67e47e95..3a43dd29 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -67,8 +67,8 @@ serd_bufalloc(size_t size)
{
#ifdef HAVE_POSIX_MEMALIGN
void* ptr;
- posix_memalign(&ptr, SERD_PAGE_SIZE, size);
- return ptr;
+ const int ret = posix_memalign(&ptr, SERD_PAGE_SIZE, size);
+ return ret ? NULL : ptr;
#else
return malloc(size);
#endif