Free mmaped area if keys fail to load

Keys for package verification is loaded after the update
package is mmaped into memory. This mmaped area needs
to be freed when exiting the function.

Another approach would be to mmap after loading the keys.

Change-Id: Ib77711a8acd5c363b5517da12dc311fb8f9f4605
Signed-off-by: WiZarD <WiZarD.Devel@gmail.com>
This commit is contained in:
WiZarD
2016-08-08 10:30:16 +05:30
committed by Winny Mathew Kurian
parent c158cf0a14
commit edafac6c7b
+1
View File
@@ -229,6 +229,7 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount)
std::vector<Certificate> loadedKeys;
if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) {
LOGE("Failed to load keys\n");
sysReleaseMap(&map);
return INSTALL_CORRUPT;
}
LOGI("%zu key(s) loaded from %s\n", loadedKeys.size(), PUBLIC_KEYS_FILE);