From c76c98ba7c091121b1b00b947bd8cc155932f9e1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 15 Dec 2021 14:58:11 +0900 Subject: [PATCH] Fix memory leak Change-Id: I0d7f57e53c092f757d9c1b30a20772abe08ec626 Signed-off-by: Hwankyu Jhun --- src/bundle_cpp.cc | 1 + src/json-internal.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bundle_cpp.cc b/src/bundle_cpp.cc index b8d254b..2ced838 100644 --- a/src/bundle_cpp.cc +++ b/src/bundle_cpp.cc @@ -118,6 +118,7 @@ Bundle::KeyInfo::KeyInfo(const KeyInfo& k) : impl_(new Impl(this)) { impl_->handle_ = bundle_keyval_dup(k.impl_->handle_); impl_->name_ = k.impl_->name_; + impl_->own_ = true; if (impl_->handle_ == nullptr) throw std::bad_alloc(); } diff --git a/src/json-internal.cc b/src/json-internal.cc index dd8c7df..a6bcdd3 100644 --- a/src/json-internal.cc +++ b/src/json-internal.cc @@ -118,6 +118,7 @@ std::string Json::ToString() { if (json == nullptr) THROW(BUNDLE_ERROR_OUT_OF_MEMORY); + std::unique_ptr json_auto(json, g_free); json_ = json; return json_; } -- 2.7.4