From 6a9388918cf8721a2e8e22db5d15118a79d45cd0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 26 Mar 2019 06:51:44 +0100 Subject: [PATCH] exception: use dynamic memory for std::runtime_error::what() --- common/include/villas/exceptions.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/include/villas/exceptions.hpp b/common/include/villas/exceptions.hpp index fa96cbf10..39824a214 100644 --- a/common/include/villas/exceptions.hpp +++ b/common/include/villas/exceptions.hpp @@ -117,7 +117,9 @@ public: ss << " Please consult the user documentation for details:" << std::endl; ss << " " << docUri() << std::endl; - return ss.str().c_str(); + auto str = new std::string(ss.str()); + + return str->c_str(); } };