Fix free() in keymaster VTS

am: 555cb5e13b

Change-Id: Ida0db54bf04cc81b8dfe218f4e2835e59947e6b7
This commit is contained in:
Hung-ying Tyan 2018-08-10 14:31:03 -07:00 committed by android-build-merger
commit 3c07de32fc
2 changed files with 8 additions and 6 deletions

View file

@ -20,6 +20,7 @@
#include <iostream>
#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/x509.h>
#include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
@ -322,11 +323,11 @@ bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) {
char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0);
EXPECT_STREQ("/CN=Android Keystore Key", cert_sub)
<< "Cert " << i << " has wrong subject. (Possibly b/38394614)";
free(cert_sub);
OPENSSL_free(cert_sub);
}
free(cert_issuer);
free(signer_subj);
OPENSSL_free(cert_issuer);
OPENSSL_free(signer_subj);
if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl;
}

View file

@ -20,6 +20,7 @@
#include <iostream>
#include <openssl/evp.h>
#include <openssl/mem.h>
#include <openssl/x509.h>
#include <cutils/properties.h>
@ -208,11 +209,11 @@ bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) {
char* cert_sub = X509_NAME_oneline(X509_get_subject_name(key_cert.get()), nullptr, 0);
EXPECT_STREQ("/CN=Android Keystore Key", cert_sub)
<< "Cert " << i << " has wrong subject.";
free(cert_sub);
OPENSSL_free(cert_sub);
}
free(cert_issuer);
free(signer_subj);
OPENSSL_free(cert_issuer);
OPENSSL_free(signer_subj);
if (dump_Attestations) std::cout << bin2hex(chain[i]) << std::endl;
}