goto cleanup;
}
- if (hypervInvokeMethod(priv, params, NULL) < 0) {
+ if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not press key %d"),
translatedKeycodes[i]);
goto cleanup;
goto cleanup;
}
- if (hypervInvokeMethod(priv, params, NULL) < 0) {
+ if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not release key %s"),
keycodeStr);
goto cleanup;
}
}
- if (hypervInvokeMethod(priv, params, NULL) < 0) {
+ if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not set memory"));
goto cleanup;
}
/*
* hypervInvokeMethod:
* @priv: hypervPrivate object associated with the connection
- * @params: object containing the all necessary information for method
- * invocation
+ * @paramsPtr: pointer to object containing the all necessary information for
+ * method invocation (consumed on invocation)
* @res: Optional out parameter to contain the response XML.
*
- * Performs an invocation described by @params, and optionally returns the
- * XML containing the result. Returns -1 on failure, 0 on success.
+ * Performs an invocation described by object at @paramsPtr, and optionally
+ * returns the XML containing the result.
+ *
+ * Please note that, object at @paramsPtr is consumed by this function and the
+ * pointer is cleared out, regardless of returning success or failure.
+ *
+ * Returns -1 on failure, 0 on success.
*/
int
-hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr params,
- WsXmlDocH *res)
+hypervInvokeMethod(hypervPrivate *priv,
+ hypervInvokeParamsListPtr *paramsPtr,
+ WsXmlDocH *res)
{
+ hypervInvokeParamsListPtr params = *paramsPtr;
int result = -1;
size_t i = 0;
int returnCode;
VIR_FREE(instanceID);
hypervFreeObject(priv, (hypervObject *)job);
hypervFreeInvokeParams(params);
+ *paramsPtr = NULL;
return result;
}
void hypervFreeEmbeddedParam(virHashTablePtr p);
-int hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr params,
- WsXmlDocH *res);
+int hypervInvokeMethod(hypervPrivate *priv,
+ hypervInvokeParamsListPtr *paramsPtr,
+ WsXmlDocH *res);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* CIM/Msvm_ReturnCode