From: Jihoi Kim Date: Fri, 3 Jan 2025 06:36:39 +0000 (+0900) Subject: Fix static analysis issue X-Git-Tag: accepted/tizen/unified/20250114.104251~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca407f7960ee59cab8578efc7ffe53d96026bb5e;p=platform%2Fcore%2Fbase%2Fbundle.git Fix static analysis issue - Fix FORWARD_NULL - Fix UNINIT_CTOR Change-Id: I2c883caed16315b804a30a16fcee82716979a3e7 Signed-off-by: Jihoi Kim --- diff --git a/src/bundle/bundle_cpp.cc b/src/bundle/bundle_cpp.cc index c8396c4..a73cf1f 100644 --- a/src/bundle/bundle_cpp.cc +++ b/src/bundle/bundle_cpp.cc @@ -481,9 +481,11 @@ std::vector Bundle::GetByte(const std::string& key) const { auto& raw_values = key_info->GetValues(); unsigned char* bytes = nullptr; - if (!raw_values.empty()) + size_t size = 0; + if (!raw_values.empty()) { bytes = reinterpret_cast(raw_values[0].get()); - auto size = reinterpret_cast(key_info->GetValuesSize()[0]); + size = reinterpret_cast(key_info->GetValuesSize()[0]); + } return std::vector(bytes, bytes + size); } diff --git a/src/parcel/parcel.cc b/src/parcel/parcel.cc index 7ad28b9..63fbaef 100644 --- a/src/parcel/parcel.cc +++ b/src/parcel/parcel.cc @@ -42,13 +42,9 @@ Parcel::Impl::Impl(Parcel* parent, size_t data_capacity, uint8_t* data) data_ = static_cast(malloc(data_capacity_)); } -Parcel::Impl::Impl(Parcel* parent, uint8_t* start_pos, size_t data_size) { - data_ = start_pos; - data_capacity_ = data_size; - data_size_ = 0; - ownership_ = false; - pin_ = true; -} +Parcel::Impl::Impl(Parcel* parent, uint8_t* start_pos, size_t data_size) + : parent_(parent), data_capacity_(data_size), data_size_(0), + data_(start_pos), ownership_(false), pin_(true) {} Parcel::Impl::~Impl() { if (ownership_) free(data_);