From 325bd8daf5aef1ba1b5f4b52293f52204c4d8780 Mon Sep 17 00:00:00 2001 From: "j-h.choi" Date: Wed, 20 Nov 2019 10:30:58 +0900 Subject: [PATCH] Fixed Svace(memory_leak) --- NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc | 2 ++ NativeLauncher/tool/ni_common.cc | 1 + NativeLauncher/tool/tac_common.cc | 1 + 3 files changed, 4 insertions(+) diff --git a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc index 7f75b37..da66f24 100644 --- a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc @@ -468,6 +468,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app sqlite3_free(sql); return -1; } + sqlite3_free(sql); if (count == 1) { sql = sqlite3_mprintf( "UPDATE TAC SET NAME = %Q, VERSION = %Q, NUGET = %Q WHERE PKGID = %Q AND NAME = %Q;", @@ -499,6 +500,7 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *app sqlite3_free(sql); return -1; } + sqlite3_free(sql); if (count == 1) { sql = sqlite3_mprintf( "UPDATE TAC SET NAME = %Q, VERSION = %Q, NUGET = %Q WHERE PKGID = %Q AND NAME = %Q;", diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index e4d04a5..1aebe55 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -765,6 +765,7 @@ static int regenTacCb(pkgmgrinfo_appinfo_h handle, void *userData) char *sql = sqlite3_mprintf("SELECT * FROM TAC WHERE PKGID = %Q;", pkgId); std::vector nugets = dbSelect(tac_db, TAC_APP_LIST_DB, sql); + sqlite3_free(sql); if (tac_db) { dbClose(tac_db); diff --git a/NativeLauncher/tool/tac_common.cc b/NativeLauncher/tool/tac_common.cc index ce104b8..33d3eb6 100644 --- a/NativeLauncher/tool/tac_common.cc +++ b/NativeLauncher/tool/tac_common.cc @@ -126,6 +126,7 @@ static int restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData) "VALUES (%Q, %Q, %Q, %Q);", pkgId, nuget.c_str(), name.c_str(), version.c_str()); dbInsert(tac_db, TAC_APP_LIST_RESTORE_DB, sql); restore_nuget.push_back(concatPath(__TAC_DIR, nuget)); + sqlite3_free(sql); } } parserData.clear(); -- 2.7.4