Fix memory leak on bson object