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; }