0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 12:41:06 +08:00

Fix memory leak

This commit is contained in:
TodorHryn 2022-05-16 13:21:20 +03:00
parent 363ebdde91
commit 6fbf32140b

View File

@ -4712,7 +4712,11 @@ PUGI__NS_BEGIN
size_t length = 0;
// coverity[var_deref_model]
if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);
if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable))
{
if (own && contents) impl::xml_memory::deallocate(contents);
return impl::make_parse_result(status_out_of_memory);
}
// delete original buffer if we performed a conversion
if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents);