diff options
author | Dan Albert <danalbert@google.com> | 2014-06-03 16:53:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-03 16:53:47 +0000 |
commit | 2f9400b679ffe08f7190781e64edda5edf0f7297 (patch) | |
tree | 96c6f553cf8637c81fefba0c8917a8bfe1164fb3 /libc/bionic | |
parent | 987bd5c64f1381185f27afb60ec46be5e9eaba36 (diff) | |
parent | 989725940e765f0065b2bc06b881cde864b62595 (diff) | |
download | android_bionic-2f9400b679ffe08f7190781e64edda5edf0f7297.tar.gz android_bionic-2f9400b679ffe08f7190781e64edda5edf0f7297.tar.bz2 android_bionic-2f9400b679ffe08f7190781e64edda5edf0f7297.zip |
Merge "Use __libc_fatal() for failed malloc in new"
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/new.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/bionic/new.cpp b/libc/bionic/new.cpp index cb19dfae2..fcfd1bdf5 100644 --- a/libc/bionic/new.cpp +++ b/libc/bionic/new.cpp @@ -14,15 +14,18 @@ * limitations under the License. */ +#include <errno.h> #include <new> #include <stdlib.h> +#include "private/libc_logging.h" + const std::nothrow_t std::nothrow = {}; void* operator new(std::size_t size) { void* p = malloc(size); if (p == NULL) { - abort(); + __libc_fatal("new failed to allocate %zu bytes", size); } return p; } @@ -30,7 +33,7 @@ void* operator new(std::size_t size) { void* operator new[](std::size_t size) { void* p = malloc(size); if (p == NULL) { - abort(); + __libc_fatal("new[] failed to allocate %zu bytes", size); } return p; } |