1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "bundle_info.h" 17 18 #include "bundle_info_utils.h" 19 #include "securec.h" 20 #include "utils.h" 21 ClearBundleInfo(BundleInfo * bundleInfo)22void ClearBundleInfo(BundleInfo *bundleInfo) 23 { 24 if (bundleInfo == nullptr) { 25 return; 26 } 27 AdapterFree(bundleInfo->bundleName); 28 AdapterFree(bundleInfo->versionName); 29 AdapterFree(bundleInfo->label); 30 AdapterFree(bundleInfo->bigIconPath); 31 AdapterFree(bundleInfo->codePath); 32 AdapterFree(bundleInfo->dataPath); 33 AdapterFree(bundleInfo->vendor); 34 OHOS::BundleInfoUtils::ClearModuleInfos(bundleInfo->moduleInfos, bundleInfo->numOfModule); 35 AdapterFree(bundleInfo->moduleInfos); 36 AdapterFree(bundleInfo->appId); 37 #ifdef OHOS_APPEXECFWK_BMS_BUNDLEMANAGER 38 OHOS::BundleInfoUtils::ClearAbilityInfos(bundleInfo->abilityInfos, bundleInfo->numOfAbility); 39 AdapterFree(bundleInfo->abilityInfos); 40 #else 41 AdapterFree(bundleInfo->smallIconPath); 42 ClearAbilityInfo(bundleInfo->abilityInfo); 43 AdapterFree(bundleInfo->abilityInfo); 44 #endif 45 } 46