|
@@ -572,11 +572,11 @@ clear_sp_basic256sha256(UA_SecurityPolicy *securityPolicy) {
|
|
|
if(securityPolicy == NULL)
|
|
|
return;
|
|
|
|
|
|
+ UA_ByteString_deleteMembers(&securityPolicy->localCertificate);
|
|
|
+
|
|
|
if(securityPolicy->policyContext == NULL)
|
|
|
return;
|
|
|
|
|
|
- UA_ByteString_deleteMembers(&securityPolicy->localCertificate);
|
|
|
-
|
|
|
/* delete all allocated members in the context */
|
|
|
Basic256Sha256_PolicyContext *pc = (Basic256Sha256_PolicyContext *)
|
|
|
securityPolicy->policyContext;
|
|
@@ -861,7 +861,11 @@ UA_SecurityPolicy_Basic256Sha256(UA_SecurityPolicy *policy,
|
|
|
policy->updateCertificateAndPrivateKey = updateCertificateAndPrivateKey_sp_basic256sha256;
|
|
|
policy->clear = clear_sp_basic256sha256;
|
|
|
|
|
|
- return policyContext_newContext_sp_basic256sha256(policy, localPrivateKey);
|
|
|
+ UA_StatusCode res = policyContext_newContext_sp_basic256sha256(policy, localPrivateKey);
|
|
|
+ if(res != UA_STATUSCODE_GOOD)
|
|
|
+ clear_sp_basic256sha256(policy);
|
|
|
+
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
#endif
|