summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2015-09-26 22:40:03 +0200
committerMatt Mower <mowerm@gmail.com>2015-11-12 02:42:27 +0100
commit13a8f0b2946965b66d31f02110a4336716625b4c (patch)
tree8edee1d423c9d83795a9a7994032a4ca0edc0787
parentMove reloading of theme outside of the action thread (diff)
downloadandroid_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar.gz
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar.bz2
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar.lz
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar.xz
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.tar.zst
android_bootable_recovery-13a8f0b2946965b66d31f02110a4336716625b4c.zip
-rw-r--r--partition.cpp1
-rw-r--r--twinstall.cpp3
-rw-r--r--twrp-functions.cpp6
3 files changed, 10 insertions, 0 deletions
diff --git a/partition.cpp b/partition.cpp
index e110ba71a..5058e1d5b 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1572,6 +1572,7 @@ bool TWPartition::Wipe_Encryption() {
} else {
LOGINFO("Successfully wiped crypto footer.\n");
}
+ free(buffer);
}
}
}
diff --git a/twinstall.cpp b/twinstall.cpp
index c1ff70501..7eea07dd2 100644
--- a/twinstall.cpp
+++ b/twinstall.cpp
@@ -182,9 +182,12 @@ static int Run_Update_Binary(const char *path, ZipArchive *Zip, int* wipe_cache)
close(pipe_fd[0]);
execve(Temp_Binary.c_str(), (char* const*)args, environ);
printf("E:Can't execute '%s': %s\n", Temp_Binary.c_str(), strerror(errno));
+ free(temp);
_exit(-1);
}
close(pipe_fd[1]);
+ free(temp);
+ temp = NULL;
*wipe_cache = 0;
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 12e88dde2..644d5657a 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -208,32 +208,38 @@ int TWFunc::Try_Decrypting_File(string fn, string password) {
f = fopen(fn.c_str(), "rb");
if (f == NULL) {
LOGERR("Failed to open '%s' to try decrypt\n", fn.c_str());
+ oaes_free(&ctx);
return -1;
}
read_len = fread(buffer, sizeof(uint8_t), 4096, f);
if (read_len <= 0) {
LOGERR("Read size during try decrypt failed\n");
fclose(f);
+ oaes_free(&ctx);
return -1;
}
if (oaes_decrypt(ctx, buffer, read_len, NULL, &out_len) != OAES_RET_SUCCESS) {
LOGERR("Error: Failed to retrieve required buffer size for trying decryption.\n");
fclose(f);
+ oaes_free(&ctx);
return -1;
}
buffer_out = (uint8_t *) calloc(out_len, sizeof(char));
if (buffer_out == NULL) {
LOGERR("Failed to allocate output buffer for try decrypt.\n");
fclose(f);
+ oaes_free(&ctx);
return -1;
}
if (oaes_decrypt(ctx, buffer, read_len, buffer_out, &out_len) != OAES_RET_SUCCESS) {
LOGERR("Failed to decrypt file '%s'\n", fn.c_str());
fclose(f);
free(buffer_out);
+ oaes_free(&ctx);
return 0;
}
fclose(f);
+ oaes_free(&ctx);
if (out_len < 2) {
LOGINFO("Successfully decrypted '%s' but read length too small.\n", fn.c_str());
free(buffer_out);