cpp: Exit TNonBlockingServer on memmory allocation failure
setrlimit causes bad_alloc exceptions, but undefined behavior occurs if
we don't exit. It is not typical for libraries to call exit, but it is
not clear what other behavior is possible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920665 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TNonblockingServer.cpp b/lib/cpp/src/server/TNonblockingServer.cpp
index a9c1c15..26e97c9 100644
--- a/lib/cpp/src/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/server/TNonblockingServer.cpp
@@ -62,6 +62,9 @@
cerr << "TNonblockingServer client died: " << ttx.what() << endl;
} catch (TException& x) {
cerr << "TNonblockingServer exception: " << x.what() << endl;
+ } catch (bad_alloc&) {
+ cerr << "TNonblockingServer caught bad_alloc exception.";
+ exit(-1);
} catch (...) {
cerr << "TNonblockingServer uncaught exception." << endl;
}