From 8d626822020a76558ef0b7400b6870e89ecd12b0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 4 Aug 2013 00:02:52 +0900 Subject: [PATCH] Fix segmentation fault if RpcMethod::process throws exception --- src/RpcMethod.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RpcMethod.cc b/src/RpcMethod.cc index dc90bb1a..d7a455f3 100644 --- a/src/RpcMethod.cc +++ b/src/RpcMethod.cc @@ -71,7 +71,8 @@ std::unique_ptr RpcMethod::createErrorResponse RpcResponse RpcMethod::execute(RpcRequest req, DownloadEngine* e) { try { - return RpcResponse(0, process(req, e), std::move(req.id)); + auto r = process(req, e); + return RpcResponse(0, std::move(r), std::move(req.id)); } catch(RecoverableException& ex) { A2_LOG_DEBUG_EX(EX_EXCEPTION_CAUGHT, ex); return RpcResponse(1, createErrorResponse(ex, req), std::move(req.id));