[xmlsec] Re: Leaks memory in version 0.0.14. Help me! Thank you.

Aleksey Sanin aleksey at aleksey.com
Tue Apr 22 07:11:58 PDT 2003


I am not sure I can help you without information "where the memory leak is".
Anyway, it seems that you did not cleanup OpenSSL completely. Try to add
the following lines at the very end:

    #ifndef XMLSEC_NO_X509
        X509_TRUST_cleanup();
    #endif /* XMLSEC_NO_X509 */
                                                                               
    #ifndef XMLSEC_OPENSSL_096
        CRYPTO_cleanup_all_ex_data();
    #endif /* XMLSEC_OPENSSL_096 */
                                                                               
        /* finally cleanup errors */
        ERR_remove_state(0);
        ERR_free_strings();
   

Aleksey
                                                                           

Francisco Lechón wrote:

> Hello to all.  I am using version 0.0.14, and have detected that they 
> exist leaks memory.  Somebody can indicate to me that functions I must 
> use to clean all the used memory.  I this using the following ones:
>
>   /** Init OpenSSL     */
>   while (RAND_status() != 1) {RAND_seed(&rnd_seed, 
> sizeof(rnd_seed));    }
>
>   /** Init libxml     */
>   xmlInitParser();
>   LIBXML_TEST_VERSION
>
>   /** Init xmlsec     */
>   xmlSecInit();
>
>   /** * Create Keys managers     */
>   keysMngr = xmlSecSimpleKeysMngrCreate();
>   if(keysMngr == NULL) { goto done;     }
>
>   /** * load key  */
>   if(xmlSecSimpleKeysMngrLoadPemKey(keysMngr, argv[1], NULL, NULL, 1) 
> == NULL) { goto done;    }
>
>   /** Create Signature Context    */
>   dsigCtx = xmlSecDSigCtxCreate(keysMngr);
>   if(dsigCtx == NULL) {goto done;     }
>
> ...........
> ...........
> ...........
> ...........
>
> done:
>
>   if(dsigCtx != NULL) { xmlSecDSigCtxDestroy(dsigCtx);    }
>   if(keysMngr != NULL) {xmlSecSimpleKeysMngrDestroy(keysMngr);    }
>   xmlSecShutdown();
>   /* Shutdown libxml     */
>   xmlCleanupParser();
>   /* Shutdown OpenSSL     */
>   RAND_cleanup();
>   ERR_clear_error();
> }
>
>
> A greeting and thanks.
>
>
> _________________________________________________________________
> Melodías, logos y mil servicios para tu teléfono en MSN Móviles.  
> http://www.msn.es/MSNMovil/





More information about the xmlsec mailing list