Memory leaks caused by staff iterators/code that not properly uses axis2c code.

22 views
Skip to first unread message

Mike

unread,
Sep 26, 2014, 4:43:37 AM9/26/14
to wsf-...@googlegroups.com
Hi,

Looks that staff code not properly handles iterating over some lists/structures.

[1st case]

Method:  axiom_attribute_t* DataObject::GetAxiomAttributeByLocalName(const char *szLocalName) const

It uses axutil_hash_first and axutil_hash_next to iterate over attributes.

As long as you don't break for loop everything is okey. 
If you do then you will have memory leak. It is because
 axutil_hash_next releases axutil_hash_index_t only when it reaches end of hash list.

See axis2c code of AXIS2_EXTERN axutil_hash_index_t *AXIS2_CALL axutil_hash_next(const axutil_env_t *env, axutil_hash_index_t *hi)

In this case, when the for loop is being broken before iterator end, I have to manually release hash iterator with use of  AXIS2_FREE(m_pEnv->allocator, pIndex)

[2nd case]
The same problem is when you use DataObject::AttributeBegin()DataObject::AttributeEnd() and break a loop because it uses the same implementation scheme.


Regards,
Mike

Dmitry Utkin

unread,
Sep 26, 2014, 5:42:01 AM9/26/14
to wsf-...@googlegroups.com
Hi,

The same thing was with namespace iterators, fixed in r868.

Thanks.

Next time you find a bug, please report it to Staff issues page.


пятница, 26 сентября 2014 г., 12:43:37 UTC+4 пользователь Mike написал:

Mike

unread,
Sep 26, 2014, 8:46:45 AM9/26/14
to wsf-...@googlegroups.com
:-) Okey and thank you!

Mike
Reply all
Reply to author
Forward
0 new messages