Skip to content

Commit 3cdb7f4

Browse files
committed
Coverity Scan fixes and adjustments
- In remove_duplicates, `sizeof(void**)` was used improperly for allocation and memsetting instead of `void*`; these are equivalent but the extra pointer is redundant. - Remove `var_deref_model` silencing annotation, as it is now redundant due to changes in 709ba74
1 parent caade5a commit 3cdb7f4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/pugixml.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4785,7 +4785,6 @@ PUGI_IMPL_NS_BEGIN
47854785
char_t* buffer = NULL;
47864786
size_t length = 0;
47874787

4788-
// coverity[var_deref_model]
47894788
if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);
47904789

47914790
// after this we either deallocate contents (below) or hold on to it via doc->buffer, so we don't need to guard it
@@ -9517,10 +9516,10 @@ PUGI_IMPL_NS_BEGIN
95179516
size_t hash_size = 1;
95189517
while (hash_size < size_ + size_ / 2) hash_size *= 2;
95199518

9520-
const void** hash_data = static_cast<const void**>(alloc->allocate(hash_size * sizeof(void**)));
9519+
const void** hash_data = static_cast<const void**>(alloc->allocate(hash_size * sizeof(void*)));
95219520
if (!hash_data) return;
95229521

9523-
memset(hash_data, 0, hash_size * sizeof(const void**));
9522+
memset(hash_data, 0, hash_size * sizeof(void*));
95249523

95259524
xpath_node* write = _begin;
95269525

0 commit comments

Comments
 (0)