Skip to content

Commit

Permalink
Merge "Fix a memory leak in gatekeeper."
Browse files Browse the repository at this point in the history
  • Loading branch information
TreeHugger Robot authored and Android (Google) Code Review committed Jun 13, 2019
2 parents fd5e31f + e75fc18 commit 81ebe98
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions gatekeeperd/SoftGateKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,16 @@ class SoftGateKeeper : public GateKeeper {
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;
}

Expand Down

0 comments on commit 81ebe98

Please sign in to comment.