[xmlsec] Re: Memory leaks
Aleksey Sanin
aleksey@aleksey.com
Tue, 26 Nov 2002 17:30:14 -0800
I am sorry, but I prefer to answer on XMLSec related questions in the
mailing list.
It saves my time because others can read answers there instead of asking me.
Please try to the following:
/*
* Init OpenSSL
*/
OpenSSL_add_all_algorithms();
if((RAND_status() != 1) && (app_RAND_load_file(NULL) != 1)) {
fprintf(stderr, "Failed to initialize random numbers\n");
return(-1);
}
/*
* Init libxml
*/
xmlInitParser();
LIBXML_TEST_VERSION
/*
* Init xmlsec
*/
xmlSecInit();
keysMngr = xmlSecSimpleKeysMngrCreate();
if(keyMgr != NULL) {
xmlSecSimpleKeysMngrDestroy(keyMgr);
}
/**
* Shutdown xmlsec
*/
xmlSecShutdown();
/*
* Shutdown libxslt/libxml
*/
#ifndef XMLSEC_NO_XSLT
xsltCleanupGlobals();
#endif /* XMLSEC_NO_XSLT */
xmlCleanupParser();
/**
* Shutdown OpenSSL
*/
app_RAND_write_file(NULL);
RAND_cleanup();
EVP_cleanup();
#ifndef XMLSEC_NO_X509
X509_TRUST_cleanup();
#endif /* XMLSEC_NO_X509 */
#ifndef XMLSEC_OPENSSL096
CRYPTO_cleanup_all_ex_data();
#endif /* XMLSEC_OPENSSL096 */
Aleksey.
kathy.nguyen@sspsolutions.com wrote:
> Sorry for not using the xmlsec mailing list because I don't want my
> silly question posted on the net. Please accept my apology. I
> noticed the memory leaks in the Output window during debugging (I'm
> using MS Visual C++.NET). If I used xmlMemDisplay(outfile), then
> there was no memory allocated (MEMORY ALLOCATED : 0, MAX was 26587) as
> reported in the file. Below here is the report from MS Visual
> C++.NET. Thank you so much for your support.
>
> Detected memory leaks!
> Dumping objects ->
> {3814} normal block at 0x01E174A8, 12 bytes long.
> Data: < r w > 00 72 E1 01 00 00 00 00 A4 77 00 00
> {3813} normal block at 0x01E17428, 64 bytes long.
> Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {3812} normal block at 0x01E17388, 96 bytes long.
> Data: <(t | u o u > 28 74 E1 01 7C A0 75 00 6F A0 75 00 08 00 00 00
> {3811} normal block at 0x01E17200, 332 bytes long.
> Data: <4 > 34 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {3791} normal block at 0x01E170B8, 12 bytes long.
> Data: < o > D0 6F E1 01 00 00 00 00 04 00 00 00
> {3790} normal block at 0x01E17068, 16 bytes long.
> Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {3789} normal block at 0x01E17018, 20 bytes long.
> Data: < hp > 00 00 00 00 68 70 E1 01 00 00 00 00 04 00 00 00
> {3788} normal block at 0x01E16FD0, 12 bytes long.
> Data: < p > 04 00 00 00 18 70 E1 01 00 00 00 00
> {3787} normal block at 0x01E16F50, 64 bytes long.
> Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {3786} normal block at 0x01E16EB0, 96 bytes long.
> Data: <Po ,q ,q > 50 6F E1 01 D7 2C 71 00 CD 2C 71 00 08 00 00 00
> {108} normal block at 0x00AB6380, 4 bytes long.
> Data: < > 8C 03 0C 10
> Object dump complete.
> The program '[2360] nsesignature_test.exe: Native' has exited with
> code 0 (0x0).
>
> -----Original Message-----
> From: Aleksey Sanin [mailto:aleksey@aleksey.com]
> Sent: Tuesday, November 26, 2002 9:55 AM
> To: kathy.nguyen@sspsolutions.com; xmlsec mailing list
> Subject: Re: Memory leaks
>
>
> Do you have any print outs that show where the memory leak happens?
> Also use xmlsec mailing list, please.
>
> Aleksey.
>
> kathy.nguyen@sspsolutions.com wrote:
>
> > Hi Aleksey,
> >
> > I got the memory leaks when I called xmlSecSimpleKeysMngrCreate(), and
> > followed by xmlSecSimpleKeysMngrDestroy(). I commented out the code
> > between them just for figuring out what caused the memory leaks.
> > Thank you in advance for answering my question.
> >
> >
> > while (RAND_status() != 1)
> > RAND_seed(&rnd_seed, sizeof(rnd_seed));
> > xmlInitParser();
> > LIBXML_TEST_VERSION
> > xmlSecInit();
> > keysMngr = xmlSecSimpleKeysMngrCreate();
> > xmlSecSimpleKeysMngrDestroy(keysMngr);
> > xmlSecShutdown();
> > xmlCleanupParser();
> > RAND_cleanup();
> > ERR_clear_error();
> >
> > Regards,
> > Kathy Nguyen
> >
>