Your call correct, it works now but shows a new problem, that of
freeing two of the 4 hash tables later.

freeing the om_document with
    axiom_stax_builder_free(om_builder,env);
seams to work,


But freeing a builder when you think you have to free the om_document
is not so obvious; but you are righth the creator of my om_document 
is the axiom_stax_builder with its get_document.

However this allone does not solve the problem. They still exists.

Until one really does a 

        fldval = (a *) AXIS2_MALLOC(env->allocator, sizeof(a));
      fldval->value = axutil_strdup(env,getFLDVAL(ele, env));
      fldnam =        axutil_strdup(env,getFLDNAM(ele, env)); 

and used the axutil_strdup function; fldval and fldnam are then
added to the hash tables and I just hope that freeing the hash
tables deallocates this string space too; 

Here I have my doubts because when I do

        axutil_hash_free(htwsinp,env);
        axutil_hash_free(htwsold,env);
        //axutil_hash_free(htGWKSP,env);
        //axutil_hash_free(htwsout,env);


only htwsinp and htwsold can bee freed, while htGWKSP and htwsout
result in a exception asking me to break or continue in VS 2005

So please here is the code used to make htGWKSP

/**
        puts htwsinp hash table into htGWKSP, does like obbput in CORBA world
        the ponter to the golbal hash table htGWKSP is updated
**/
axis2_bool_t AXIS2_CALL 
axawl_put(const axutil_hash_t *htwsinp, 
                  const axutil_env_t *env, 
                  const axutil_hash_t **pphtGWKSP)              //!< load Spin 
elements into global workspace
{
        axutil_hash_t *htGWKSP = NULL;
    axutil_hash_index_t *hi;

    const void *key = NULL;
    void *val = NULL;

        htGWKSP = *pphtGWKSP;
        if (htGWKSP)
                axutil_hash_free(htGWKSP,env);  

        htGWKSP = axutil_hash_copy(htwsinp, env);
    printf("\n\nDump htGWKSP - a  copy    of htwsinp to htGWKSP - the 
traditional obbput()");
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "%s", 
           "\n\nDump htGWKSP - a  copy    of htwsinp to htGWKSP - the 
traditional obbput()");
    for (hi = axutil_hash_first(htwsinp, env); hi; hi = axutil_hash_next(env, 
hi)) {
        axutil_hash_this(hi, &key, NULL, &val);
        printf("\nkey\t: %s", key);
        printf("\tval\t: %s", ((a *) val)->value);
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "%s", key);
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "%s", ((a *) val)->value);      
  
    }
        (*pphtGWKSP) = htGWKSP;
        return AXIS2_SUCCESS;
}


Now tell me why I can not use

        axutil_hash_free(htGWKSP,env);

without getting an error raised?

And the same is true for htwsout which is a copy of htGWKSP before we return to 
the caller.
htwsout must be freed after reconstructing the AXIOM document and then 
serializing it into
the payload string to be returned from my SPg-Legacy.c server to its client 
through axis2.

Thanks and regards
Josef.Stadelmann@
axa-winterthur.ch


-----Ursprüngliche Nachricht-----
Von: Samisa Abeysinghe [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 15. Januar 2008 15:52
An: Apache AXIS C User List
Betreff: Re: execute axiom_document_free(om_document, env); // and my
hash_table key/val pairs are gone


Senaka Fernando wrote:
> 2. Consider duplicating the strings before copying to (or from) your hash.
> You can use axutil_strdup() for this purpose.
>   

Yes, this may solve your problems. I skimmed through the code given, and 
it looks to me you are using the shallow copies returned by the OM 
element accessor methods and store them in hashes without duplicating them.

Thanks,
Samisa...


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to