diff options
author | Sunmin Lee <sunm.lee@samsung.com> | 2018-08-21 17:51:07 +0900 |
---|---|---|
committer | Sunmin Lee <sunm.lee@samsung.com> | 2018-09-05 09:23:03 +0900 |
commit | a0a1a72b8c37fb91f8f08d0a56903c50659a96a8 (patch) | |
tree | 0c07f082804de46caba9dfcdd12b961c35b73e81 | |
parent | 81d8eaa0a55126e621a6c95604059a34716f54dd (diff) | |
download | libtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.tar.gz libtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.tar.bz2 libtota-a0a1a72b8c37fb91f8f08d0a56903c50659a96a8.zip |
Fix vulnerabilitysubmit/tizen_5.0/20181101.000004submit/tizen/20180905.020038accepted/tizen/unified/20180905.140113accepted/tizen/5.0/unified/20181102.021528
- Fix memory leaks
Change-Id: I594edfc2d46fee720819f31618a77a38d9686d0e
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
-rwxr-xr-x | ss_engine/SS_PatchDelta.c | 12 |
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) |