diff options
author | innokentii <innokentii@yandex-team.com> | 2023-03-23 17:02:27 +0300 |
---|---|---|
committer | innokentii <innokentii@yandex-team.com> | 2023-03-23 17:02:27 +0300 |
commit | 1b63dc868aaa1066fd2f723f739ea086a2a49601 (patch) | |
tree | f317d82984b0facf4a5d81720e5bb54cf9a124d4 /library/cpp/yaml/fyamlcpp/fyamlcpp.h | |
parent | 8007028c9d3043fe9909990721048e49127eeeec (diff) | |
download | ydb-1b63dc868aaa1066fd2f723f739ea086a2a49601.tar.gz |
Fix leaks on fyamlcpp misuse
fix possible leaks on misuse
Diffstat (limited to 'library/cpp/yaml/fyamlcpp/fyamlcpp.h')
-rw-r--r-- | library/cpp/yaml/fyamlcpp/fyamlcpp.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/library/cpp/yaml/fyamlcpp/fyamlcpp.h b/library/cpp/yaml/fyamlcpp/fyamlcpp.h index c1ec03d25f7..bcf9362d732 100644 --- a/library/cpp/yaml/fyamlcpp/fyamlcpp.h +++ b/library/cpp/yaml/fyamlcpp/fyamlcpp.h @@ -18,6 +18,12 @@ struct fy_node_pair; namespace NFyaml { +struct TStringPtrHashT { + size_t operator()(const TSimpleSharedPtr<TString>& str) const { + return (size_t)str.Get(); + } +}; + struct TFyamlEx : public yexception {}; enum class ENodeType { @@ -589,7 +595,7 @@ private: static void DestroyDocumentStrings(fy_document *fyd, void *user) { Y_UNUSED(fyd); if (user) { - auto* data = reinterpret_cast<THashSet<TString>*>(user); + auto* data = reinterpret_cast<THashSet<TSimpleSharedPtr<TString>, TStringPtrHashT>*>(user); delete data; } } |