summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyutyunkov Vyacheslav <tve@softmotions.com>2015-07-13 18:45:42 +0600
committerTyutyunkov Vyacheslav <tve@softmotions.com>2015-07-13 18:45:42 +0600
commit0b2a32eb407b92993d7e551d02a6ecc5f78a28bb (patch)
tree8c5a85f68f0c09c77eaa988a55e0fc2e7b173a3b
parent161e67aeefdbfff815eab9e3fe95de7c14fd1e27 (diff)
downloadejdb-0b2a32eb407b92993d7e551d02a6ecc5f78a28bb.tar.gz
ejdb-0b2a32eb407b92993d7e551d02a6ecc5f78a28bb.tar.bz2
ejdb-0b2a32eb407b92993d7e551d02a6ecc5f78a28bb.zip
#148 - memory leak fixes
-rw-r--r--src/bson/bson.c2
-rw-r--r--src/ejdb/tests/ejdbtest2.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/bson/bson.c b/src/bson/bson.c
index 1fa3c77..ac6a626 100644
--- a/src/bson/bson.c
+++ b/src/bson/bson.c
@@ -1823,6 +1823,7 @@ static void _bson_fix_duplicate_keys(bson_iterator *it, bson *bso) {
BSON_ITERATOR_INIT(&it2, &bst);
_bson_fix_duplicate_keys(&it2, bso);
bson_append_finish_object(bso);
+ bson_destroy(&bst);
} else if (bt2 == BSON_ARRAY) {
char ibuf[TCNUMBUFSIZ];
memset(ibuf, '\0', TCNUMBUFSIZ);
@@ -1860,7 +1861,6 @@ static void _bson_fix_duplicate_keys(bson_iterator *it, bson *bso) {
} else {
bson_append_field_from_iterator(&it2, bso);
}
- tclistclear(dups);
tclistdel(dups);
}
tcmapdel(keys);
diff --git a/src/ejdb/tests/ejdbtest2.c b/src/ejdb/tests/ejdbtest2.c
index 51e0c14..bbba0a6 100644
--- a/src/ejdb/tests/ejdbtest2.c
+++ b/src/ejdb/tests/ejdbtest2.c
@@ -6101,6 +6101,9 @@ void testTicket148(void) {
bt = bson_find_fieldpath_value("info.name.mot.age", &it);
CU_ASSERT_TRUE(BSON_IS_NUM_TYPE(bt));
CU_ASSERT_EQUAL(bson_iterator_int(&it), 35);
+
+ ejdbquerydel(q1);
+ tclistdel(q1res);
}