Moving the cmd cleanup back to the error path, as the cmd was used later in the succe...
authorMark Donnelly <mark@painless-security.com>
Thu, 16 Jul 2015 15:06:35 +0000 (11:06 -0400)
committerMark Donnelly <mark@painless-security.com>
Thu, 16 Jul 2015 15:06:35 +0000 (11:06 -0400)
json_gssapi/src/GSSRequest.cpp

index d7d3c07..38e6793 100644 (file)
@@ -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 */
 }