From: Youngjae Shin Date: Mon, 7 Mar 2022 01:51:17 +0000 (+0900) Subject: fix memory leak X-Git-Tag: submit/tizen/20220307.015458^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b103dd1c4f8a7faf19253b4a22110e35e9d6fd05;p=platform%2Fcore%2Fsystem%2Fmodes-plugins.git fix memory leak Change-Id: I1449e3dd0b3ebf3e2e671d46b14969894e6c0879 --- diff --git a/pkg/PkgEnableSupportMode.cpp b/pkg/PkgEnableSupportMode.cpp index c4fd7e9..0f938cc 100644 --- a/pkg/PkgEnableSupportMode.cpp +++ b/pkg/PkgEnableSupportMode.cpp @@ -37,12 +37,6 @@ int PkgSupportMode::set(int val) int ret; pkgmgrinfo_appinfo_filter_h filter; - ret = pkgmgrinfo_appinfo_filter_create(&filter); - if (ret != PMINFO_R_OK) { - ERR("pkgmgrinfo_appinfo_filter_create() Fail(%d)", ret); - return MODES_ERROR_SYSTEM; - } - switch (val) { case ULTRA_POWER_SAVING: case COOL_DOWN: @@ -54,6 +48,12 @@ int PkgSupportMode::set(int val) return MODES_ERROR_INVALID_PARAMETER; } + ret = pkgmgrinfo_appinfo_filter_create(&filter); + if (ret != PMINFO_R_OK) { + ERR("pkgmgrinfo_appinfo_filter_create() Fail(%d)", ret); + return MODES_ERROR_SYSTEM; + } + pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, appListCB, this); pkgmgrinfo_appinfo_filter_destroy(filter);