[automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d

Change-Id: I2e9d6b1a5badb501adc641b17ce337c911d09610
This commit is contained in:
Android Build Merger (Role) 2019-06-20 22:31:13 +00:00
commit 7535975701
1 changed files with 4 additions and 11 deletions

View File

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