From 692648de96515132b59b71d6c404a4cd8253ce1d Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Mon, 2 Jul 2012 06:11:29 +0200 Subject: [PATCH] mtrie: Do not throw exception on allocation failure --- src/mtrie.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mtrie.cpp b/src/mtrie.cpp index 10bf673a..9187a6cd 100644 --- a/src/mtrie.cpp +++ b/src/mtrie.cpp @@ -72,8 +72,10 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_, // We are at the node corresponding to the prefix. We are done. if (!size_) { bool result = !pipes; - if (!pipes) - pipes = new pipes_t; + if (!pipes) { + pipes = new (std::nothrow) pipes_t; + alloc_assert (pipes); + } pipes->insert (pipe_); return result; }