From 489750c80a3aa5572be8c1675631af1bc0c0ed3d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 9 Oct 2014 18:09:38 -0400 Subject: [PATCH] Errors - Added error handling for std::bad_alloc. --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 8367ec0f1..867eff6da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,12 @@ int main (int argc, const char** argv) status = -1; } + catch (std::bad_alloc& error) + { + std::cerr << "Error: Memory allocation failed: " << error.what () << "\n"; + status = -3; + } + catch (...) { std::cerr << STRING_UNKNOWN_ERROR << "\n";