summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2018-08-21 17:51:07 +0900
committerSunmin Lee <sunm.lee@samsung.com>2018-09-05 09:23:03 +0900
commita0a1a72b8c37fb91f8f08d0a56903c50659a96a8 (patch)
tree0c07f082804de46caba9dfcdd12b961c35b73e81
parent81d8eaa0a55126e621a6c95604059a34716f54dd (diff)
downloadlibtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.tar.gz
libtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.tar.bz2
libtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.zip
- Fix memory leaks Change-Id: I594edfc2d46fee720819f31618a77a38d9686d0e Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
-rwxr-xr-xss_engine/SS_PatchDelta.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ss_engine/SS_PatchDelta.c b/ss_engine/SS_PatchDelta.c
index 6d8c056..c2dcf33 100755
--- a/ss_engine/SS_PatchDelta.c
+++ b/ss_engine/SS_PatchDelta.c
@@ -281,10 +281,11 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
LOGL(LOG_SSENGINE, "Source was currupted, Try loading from backup source\n");
if (SS_LoadFile(target_filename, &target_file) == 0) {
+ if (target_file.data)
+ SS_Free(target_file.data);
+
if (memcmp(target_file.sha1, target_sha1, SHA_DIGEST_SIZE) == 0) {
LOGL(LOG_SSENGINE, "Patch Already applied\n");
- if (target_file.data)
- SS_Free(target_file.data);
return S_SS_SUCCESS;
}
}
@@ -317,10 +318,11 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
} else {
LOGL(LOG_SSENGINE, "Source was deleted!!\n");
if (SS_LoadFile(target_filename, &target_file) == 0) {
+ if (target_file.data)
+ SS_Free(target_file.data);
+
if (memcmp(target_file.sha1, target_sha1, SHA_DIGEST_SIZE) == 0) {
LOGL(LOG_SSENGINE, "Patch Already applied\n");
- if (target_file.data)
- SS_Free(target_file.data);
return S_SS_SUCCESS;
}
}
@@ -330,6 +332,8 @@ int SS_UpdateDeltaFS(const char *source_filename, const char *target_filename,
if (memcmp(source_file.sha1, source_sha1, SHA_DIGEST_SIZE) == 0) {
use_backup = 1;
LOGL(LOG_SSENGINE, "Patch Can be applied from using backup file as source\n");
+ if (source_file.data)
+ SS_Free(source_file.data);
} else {
SS_SetUpgradeState(E_SS_FSSRCCURRUPTED);
if (source_file.data)