From 0b2a32eb407b92993d7e551d02a6ecc5f78a28bb Mon Sep 17 00:00:00 2001 From: Tyutyunkov Vyacheslav Date: Mon, 13 Jul 2015 18:45:42 +0600 Subject: #148 - memory leak fixes --- src/bson/bson.c | 2 +- src/ejdb/tests/ejdbtest2.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.3