[libxml-devel] patch for memory leak

Tom Bagby tbagby at kosmix.com
Wed Jul 2 15:04:18 EDT 2008


I also found a bunch of similar leaks, plus one different kind which was leaking on every xpath find.  I communicated once with Dan Janowski and sent him this set of patches, then never heard back from him again, so not sure what happened.  Here are the leaks I fixed, if you have others, please make a diff and post them!  I could really use it!

-----Original Message-----
From: libxml-devel-bounces at rubyforge.org on behalf of Charlie Savage
Sent: Tue 7/1/2008 12:07 AM
To: libxml-devel at rubyforge.org
Subject: Re: [libxml-devel] patch for memory leak
 
Hi Tom,


> I found a memory leak when the value of an attribute is accessed.  Fix 
> is simple, in function ruby_xml_attr_value in ruby_xml_attr.c, need to 
> call xmlFree:
> 
> 356,357c356,360
> 
> <     if (value != NULL)
> 
> <       return(rb_str_new2((const char*)value));
> 
> ---
> 
>>     if (value != NULL) {
> 
>>       VALUE retVal = rb_str_new2((const char*)value);
> 
>>       xmlFree(value);
> 
>>       return(retVal);
> 

Thanks for the patch.  I've applied it, and found about 6 other places 
similar issues were happening.

Charlie



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5841 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/libxml-devel/attachments/20080702/d29d5f36/attachment.bin>


More information about the libxml-devel mailing list