fix memory leak accepted/tizen/unified/20220307.232323 submit/tizen/20220307.015458
authorYoungjae Shin <yj99.shin@samsung.com>
Mon, 7 Mar 2022 01:51:17 +0000 (10:51 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 7 Mar 2022 01:54:25 +0000 (10:54 +0900)
Change-Id: I1449e3dd0b3ebf3e2e671d46b14969894e6c0879

pkg/PkgEnableSupportMode.cpp

index c4fd7e9..0f938cc 100644 (file)
@@ -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);