From 8cde3ad57b620f226c07b54615920442d7477231 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 9 Aug 2023 16:43:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=85=8D=E7=BD=AE=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/gb_json.cpp | 7 ++++++- sane/scanner.cpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sane/gb_json.cpp b/sane/gb_json.cpp index 967b387..0187200 100644 --- a/sane/gb_json.cpp +++ b/sane/gb_json.cpp @@ -178,7 +178,8 @@ namespace gb simple_val_.dval = val; } json::json(const char* key, const char* val) : type_(VAL_TYPE_STRING), key_(key ? key : ""), strval_(val ? val : ""), cur_child_(-1) - {} + { + } json::json(json& r) { copy_from(r); @@ -1437,6 +1438,7 @@ namespace gb name = child->key(); child->value(raw_v); val = sane_config_schm::from_hex_letter(raw_v.c_str(), raw_v.length()); + child->release(); ret = true; } @@ -1454,6 +1456,7 @@ namespace gb name = child->key(); child->value(raw_v); val = sane_config_schm::from_hex_letter(raw_v.c_str(), raw_v.length()); + child->release(); ret = true; } @@ -1706,6 +1709,7 @@ namespace gb { clear(); global_->release(); + opt_default_value_->release(); } bool scanner_cfg::update(const char* file, LPUDF func) @@ -1776,6 +1780,7 @@ namespace gb glb->get_value(scanner_cfg::cur_sel_.c_str(), sel); glb->release(); glb = jsn->first_child(); + glb->release(); while ((glb = jsn->next_child())) { std::string val(""); diff --git a/sane/scanner.cpp b/sane/scanner.cpp index e83802f..b468a8b 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -544,6 +544,7 @@ scanner::~scanner() if (cfg_) { + cfg_->remove_all_schemes(); // schemes would add_ref on cfg_, so we clear them first. NOTE: do not call save after this !!! cfg_->release(); cfg_ = NULL; }