From 81a98b88f072b3f57309c77738020dcc99646744 Mon Sep 17 00:00:00 2001 From: fengj130406 Date: Fri, 21 Feb 2025 18:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengj130406 --- interfaces/innerkits/src/bundle_active_module_record.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/interfaces/innerkits/src/bundle_active_module_record.cpp b/interfaces/innerkits/src/bundle_active_module_record.cpp index 1a039e6..5326560 100644 --- a/interfaces/innerkits/src/bundle_active_module_record.cpp +++ b/interfaces/innerkits/src/bundle_active_module_record.cpp @@ -119,18 +119,14 @@ BundleActiveModuleRecord *BundleActiveModuleRecord::Unmarshalling(Parcel &parcel if (size > MAX_FORM_NUM) { return nullptr; } - BundleActiveFormRecord *tmp = new (std::nothrow) BundleActiveFormRecord; - if (tmp == nullptr) { - return result; - } + for (uint32_t i = 0; i < size; i++) { - tmp = tmp->Unmarshalling(parcel); + std::unique_ptr tmp(BundleActiveFormRecord::Unmarshalling(parcel)); if (!tmp) { continue; } result->formRecords_.emplace_back(*tmp); } - delete tmp; return result; } -- Gitee