From: Mark Donnelly Date: Thu, 16 Jul 2015 15:06:35 +0000 (-0400) Subject: Moving the cmd cleanup back to the error path, as the cmd was used later in the succe... X-Git-Url: http://www.project-moonshot.org/gitweb/?p=gssweb.git;a=commitdiff_plain;h=232ccf184c8a98a8792fa29bcd8e2a7ba2798a8f Moving the cmd cleanup back to the error path, as the cmd was used later in the success path. --- diff --git a/json_gssapi/src/GSSRequest.cpp b/json_gssapi/src/GSSRequest.cpp index d7d3c07..38e6793 100644 --- a/json_gssapi/src/GSSRequest.cpp +++ b/json_gssapi/src/GSSRequest.cpp @@ -74,6 +74,13 @@ void GSSRequest::execute() } catch (GSSException e) { + /* Cleanup */ + if ( NULL != cmd ) + { + delete(cmd); + cmd = NULL; + } + JSONObject return_values; return_values.set("major_status", e.getMajor()); return_values.set("minor_status", e.getMinor()); @@ -82,6 +89,13 @@ void GSSRequest::execute() } catch (std::invalid_argument e) { + /* Cleanup */ + if ( NULL != cmd ) + { + delete(cmd); + cmd = NULL; + } + JSONObject return_values, errors; errors.set("major_status_message", "An error occurred in parsing the JSON arguments.\0"); errors.set("minor_status_message", e.what()); @@ -91,13 +105,6 @@ void GSSRequest::execute() response.set("return_values", return_values); } - /* Cleanup */ - if ( NULL != cmd ) - { - delete(cmd); - cmd = NULL; - } - /* return */ }