am ebc83b3e: Merge "Fix memory leak in upgrade_crypt_ftr"

* commit 'ebc83b3e8ef6d0dbab84bec88e0231c7911e5378':
  Fix memory leak in upgrade_crypt_ftr
This commit is contained in:
Elliott Hughes 2015-02-05 18:51:07 +00:00 committed by Android Git Automerger
commit e22b21af3a

View file

@ -574,6 +574,7 @@ static void upgrade_crypt_ftr(int fd, struct crypt_mnt_ftr *crypt_ftr, off64_t o
/* Need to initialize the persistent data area */
if (lseek64(fd, pdata_offset, SEEK_SET) == -1) {
SLOGE("Cannot seek to persisent data offset\n");
free(pdata);
return;
}
/* Write all zeros to the first copy, making it invalid */
@ -588,6 +589,7 @@ static void upgrade_crypt_ftr(int fd, struct crypt_mnt_ftr *crypt_ftr, off64_t o
crypt_ftr->persist_data_offset[0] = pdata_offset;
crypt_ftr->persist_data_offset[1] = pdata_offset + CRYPT_PERSIST_DATA_SIZE;
crypt_ftr->minor_version = 1;
free(pdata);
}
if ((crypt_ftr->major_version == 1) && (crypt_ftr->minor_version == 1)) {