Merge pull request #497 from TodorHryn/master

Fix memory leak
This commit is contained in:
Arseny Kapoulkine 2022-05-16 19:05:29 -07:00 committed by GitHub
commit ec851bb18d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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