[xmlsec] memory leak in xmlSecReplaceContent

Aleksey Sanin aleksey at aleksey.com
Thu Jun 17 09:00:35 PDT 2004


Hi, Tomas!

>  I found a memory leak in the xmlSecReplaceContent function.
 > ...
> 
>     xmlFreeNode(dummy);
> 
> before the return from the function may help.
> 
Good catch! I need to test this but seems that you are right. The only
thing is that you need to do two calls:
	...
	xmlUnlinkNode(dummy);
	xmlFreeNode(dummy);
	...
I'll test and fix it tonight.

> BTW: walking thru xmlSec sources a missing test for
> non-NULL-ness of encCtx->type came out at line 464.

I guess you are talking about line 464 in xmlenc.c file:

...
     } else if(xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
...

In this case, the check if "encCtx->type != NULL" is redundant
because "xmlStrEqual()" function knows how to handle NULL values.
But I will add it anyway to make it look better :)

Thanks!
Aleksey





More information about the xmlsec mailing list