浏览代码

Fix memoryleak in certificateVerification_verify

Mark 6 年之前
父节点
当前提交
85e06f22d7
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      plugins/ua_pki_certificate.c

+ 2 - 0
plugins/ua_pki_certificate.c

@@ -77,6 +77,7 @@ certificateVerification_verify(void *verificationContext,
         /*              UA_LOGCATEGORY_SECURITYPOLICY, */
         /*              "Verifying the certificate failed with error: %s", buff); */
 
+        mbedtls_x509_crt_free(&remoteCertificate);
         if(flags & MBEDTLS_X509_BADCERT_NOT_TRUSTED)
             return UA_STATUSCODE_BADCERTIFICATEUNTRUSTED;
 
@@ -91,6 +92,7 @@ certificateVerification_verify(void *verificationContext,
         return UA_STATUSCODE_BADSECURITYCHECKSFAILED;
     }
 
+    mbedtls_x509_crt_free(&remoteCertificate);
     return UA_STATUSCODE_GOOD;
 }