[automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02 am: 4ae4ad8e5b am: b25983460c

am: 20e73e23c4

Change-Id: I026aa5ddb79cd10146924fd6625816782645f660
This commit is contained in:
Janis Danisevskis 2019-06-21 13:38:10 -07:00 committed by android-build-merger
commit ca662c7118
1 changed files with 4 additions and 11 deletions

View File

@ -58,23 +58,16 @@ public:
virtual ~SoftGateKeeper() {
}
virtual bool GetAuthTokenKey(const uint8_t **auth_token_key,
uint32_t *length) const {
virtual bool GetAuthTokenKey(const uint8_t** auth_token_key, uint32_t* length) const {
if (auth_token_key == NULL || length == NULL) return false;
uint8_t *auth_token_key_copy = new uint8_t[SIGNATURE_LENGTH_BYTES];
memcpy(auth_token_key_copy, key_.get(), SIGNATURE_LENGTH_BYTES);
*auth_token_key = auth_token_key_copy;
*auth_token_key = key_.get();
*length = SIGNATURE_LENGTH_BYTES;
return true;
}
virtual void GetPasswordKey(const uint8_t **password_key, uint32_t *length) {
virtual void GetPasswordKey(const uint8_t** password_key, uint32_t* length) {
if (password_key == NULL || length == NULL) return;
uint8_t *password_key_copy = new uint8_t[SIGNATURE_LENGTH_BYTES];
memcpy(password_key_copy, key_.get(), SIGNATURE_LENGTH_BYTES);
*password_key = password_key_copy;
*password_key = key_.get();
*length = SIGNATURE_LENGTH_BYTES;
}