Commit 19f30f79 authored by Thomas Braun's avatar Thomas Braun

Problem: throwing version of new called

Solution: Pass (std::nothrow) as done in all other places.
parent 634c69ab
...@@ -415,7 +415,8 @@ void zmq::norm_engine_t::recv_data(NormObjectHandle object) ...@@ -415,7 +415,8 @@ void zmq::norm_engine_t::recv_data(NormObjectHandle object)
if (NULL == rxState) if (NULL == rxState)
{ {
// This is a new stream, so create rxState with zmq decoder, etc // This is a new stream, so create rxState with zmq decoder, etc
rxState = new NormRxStreamState(object, options.maxmsgsize); rxState = new (std::nothrow) NormRxStreamState(object, options.maxmsgsize);
if (!rxState->Init()) if (!rxState->Init())
{ {
errno_assert(false); errno_assert(false);
......
...@@ -204,9 +204,10 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool ...@@ -204,9 +204,10 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_, bool
options.linger = parent_->get (ZMQ_BLOCKY)? -1: 0; options.linger = parent_->get (ZMQ_BLOCKY)? -1: 0;
if (thread_safe) if (thread_safe)
mailbox = new mailbox_safe_t(&sync); mailbox = new (std::nothrow) mailbox_safe_t(&sync);
else { else {
mailbox_t *m = new mailbox_t(); mailbox_t *m = new (std::nothrow) mailbox_t();
if (m->get_fd () != retired_fd) if (m->get_fd () != retired_fd)
mailbox = m; mailbox = m;
else { else {
...@@ -1298,7 +1299,7 @@ void zmq::socket_base_t::start_reaping (poller_t *poller_) ...@@ -1298,7 +1299,7 @@ void zmq::socket_base_t::start_reaping (poller_t *poller_)
else { else {
scoped_optional_lock_t sync_lock(thread_safe ? &sync : NULL); scoped_optional_lock_t sync_lock(thread_safe ? &sync : NULL);
reaper_signaler = new signaler_t(); reaper_signaler = new (std::nothrow) signaler_t();
// Add signaler to the safe mailbox // Add signaler to the safe mailbox
fd = reaper_signaler->get_fd(); fd = reaper_signaler->get_fd();
......
...@@ -757,7 +757,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -757,7 +757,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// implement zmq_poll on top of zmq_poller // implement zmq_poll on top of zmq_poller
int rc; int rc;
zmq_poller_event_t *events; zmq_poller_event_t *events;
events = new zmq_poller_event_t[nitems_]; events = new (std::nothrow) zmq_poller_event_t[nitems_];
alloc_assert(events); alloc_assert(events);
void *poller = zmq_poller_new (); void *poller = zmq_poller_new ();
alloc_assert(poller); alloc_assert(poller);
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "atomic_counter.hpp" #include "atomic_counter.hpp"
#include "atomic_ptr.hpp" #include "atomic_ptr.hpp"
#include <assert.h> #include <assert.h>
#include <new>
#include <stdint.h> #include <stdint.h>
#if !defined ZMQ_HAVE_WINDOWS #if !defined ZMQ_HAVE_WINDOWS
...@@ -75,7 +76,7 @@ unsigned long zmq_stopwatch_stop (void *watch_) ...@@ -75,7 +76,7 @@ unsigned long zmq_stopwatch_stop (void *watch_)
void *zmq_threadstart(zmq_thread_fn* func, void* arg) void *zmq_threadstart(zmq_thread_fn* func, void* arg)
{ {
zmq::thread_t* thread = new zmq::thread_t; zmq::thread_t* thread = new (std::nothrow) zmq::thread_t;
thread->start(func, arg); thread->start(func, arg);
return thread; return thread;
} }
...@@ -265,7 +266,7 @@ int zmq_curve_public (char *z85_public_key, const char *z85_secret_key) ...@@ -265,7 +266,7 @@ int zmq_curve_public (char *z85_public_key, const char *z85_secret_key)
void *zmq_atomic_counter_new (void) void *zmq_atomic_counter_new (void)
{ {
zmq::atomic_counter_t *counter = new zmq::atomic_counter_t; zmq::atomic_counter_t *counter = new (std::nothrow) zmq::atomic_counter_t;
alloc_assert (counter); alloc_assert (counter);
return counter; return counter;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment