[ 
https://issues.apache.org/jira/browse/AXIS2C-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198995#comment-13198995
 ] 

Michael Tyler commented on AXIS2C-1585:
---------------------------------------

ok, you are right not sure what I was thinking.

Would have to be

void AXIS2_CALL 
axutil_allocator_free_impl( 
    axutil_allocator_t * allocator, 
    void **ptr) 
{ 
    free(*ptr); 
    *ptr = NULL; 
} 

and then the address of the address be passed in.

So not sure which is less work, changing all the calls to free or add the 'ptr 
= NULL' after ever call to free.  But I still believe it would reduce core 
dumps, because if you allow access to a 'free' functions most C coders are 
going to try to clean up the memory they allocated, but frees are attempted to 
be recusive at the highest level in Axis2/C.  

And the code all over the place is 

if( ptr )
  free(ptr);

and this leads to double freeing rapidly.
                
> Double freeing pointers
> -----------------------
>
>                 Key: AXIS2C-1585
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1585
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: util
>            Reporter: Michael Tyler
>              Labels: api-change, features, patch
>
> I believe that most of double freeing of pointer core dump issues can simple 
> by resolved by altering the axutil_allocator_free_impl function
> change 
> void AXIS2_CALL
> axutil_allocator_free_impl(
>     axutil_allocator_t * allocator,
>     void *ptr)
> {
>     free(ptr);
> }
> to 
> void AXIS2_CALL
> axutil_allocator_free_impl(
>     axutil_allocator_t * allocator,
>     void *ptr)
> {
>     free(ptr);
>     ptr = NULL;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: c-dev-h...@axis.apache.org

Reply via email to