Skip to content

Commit 6872c46

Browse files
authored
Merge pull request #357 from hgarrereyn/compare-fix
Reset length during object copy
2 parents a3806b1 + 89fa5b2 commit 6872c46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ucl_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3657,8 +3657,9 @@ ucl_object_copy_internal(const ucl_object_t *other, bool allow_array)
36573657
}
36583658

36593659
if (other->type == UCL_ARRAY || other->type == UCL_OBJECT) {
3660-
/* reset old value */
3660+
/* reset old value and length since we will re-add elements below */
36613661
memset(&new->value, 0, sizeof(new->value));
3662+
new->len = 0;
36623663

36633664
while ((cur = ucl_object_iterate(other, &it, true)) != NULL) {
36643665
if (other->type == UCL_ARRAY) {

0 commit comments

Comments
 (0)