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>
diff --git a/install.cpp b/install.cpp
index 9106db5..fa7b73e 100644
--- a/install.cpp
+++ b/install.cpp
@@ -229,6 +229,7 @@
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);