axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Pararas <jpara...@schedsys.com>
Subject Leaks in code generated by WSDL2c
Date Fri, 02 Mar 2012 22:35:14 GMT
We have found a number of memory leaks in the code generated by WSDL2c

Here they are:
1.    Looping though a hash table ...  The typical code is:
                        for (hi = axutil_hash_first(attribute_hash, 
env); hi; hi = axutil_hash_next(env, hi))
                        {
                            axutil_hash_this(hi, &key, NULL, &val);


                                if(!strcmp((axis2_char_t*)key, "result"))

                                {
                                    parent_attri = (axiom_attribute_t*)val;
                                    break;
                                }
                        }
This works fine unless the "break" occurs.  in that case the "hi" 
allocated in "axutil_hash_first" leaks.  The remedy is to add
              AXIS2_FREE(env->allocator, hi);
before the "break;" inside the loop or  to add
                if (hi) {
                  AXIS2_FREE(env->allocator, hi);
                }
at the end of the loop.

2.    Memory allocated in axutil_qname_create we found this in the 
function "axis2_stub_populate_services_for_XXX"
        (XXX is the name of our specific application service)

the generated code reads:
          svc_qname = axutil_qname_create(env,"XXX" ,NULL, NULL);
          axis2_svc_set_qname (svc, env, svc_qname);

it should be followed by:
     axutil_qname_free(svc_qname,env);
to fix the leak
This also occurs in "adb_YYY_create" (YYY being one of the nodes in our 
XML tree) but i may exist elsewhere as well.

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org


Mime
View raw message