Bugs item #11766, was opened at 2007-06-22 03:38
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=11766&group_id=494

Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Nobody (None)
>Assigned to: Charlie Savage (cfis)
Summary: XML::Node#<< behaving strangely, causing memory deallocation errors 
and wreacking havoc

Initial Comment:
The following code does two strange things:
1) returns
<n_doc><foo/>
    <bar/>
  </n_doc>
when it should return
<n_doc>
<foo/>
</n_doc>

2) Causes strange errors:
ruby(4680) malloc: ***  Deallocation of a pointer not malloced: 0x5090c0; This 
could be a double free(), or free() called with the middle of an allocated 
block; Try setting environment variable MallocHelp to see tools to help debug
ruby(4680) malloc: ***  Deallocation of a pointer not malloced: 0x509150; This 
could be a double free(), or free() called with the middle of an allocated 
block; Try setting environment variable MallocHelp to see tools to help debug
ruby(4680) malloc: ***  Deallocation of a pointer not malloced: 0x5091a0; This 
could be a double free(), or free() called with the middle of an allocated 
block; Try setting environment variable MallocHelp to see tools to help debug
ruby(4680) malloc: ***  Deallocation of a pointer not malloced: 0x5091f0; This 
could be a double free(), or free() called with the middle of an allocated 
block; Try setting environment variable MallocHelp to see tools to help debug


The code:
require 'rubygems'
require 'xml/libxml'

source = %{<?xml version="1.0"?>
<root>
  <data>
    <foo/>
    <bar/>
  </data>
</root>
}

p = XML::Parser.string(source)
doc = p.parse

data = doc.find('data').first
nodes = data.find('foo')

n_doc = XML::Node.new('n_doc')
n_doc << nodes.first

print n_doc

----------------------------------------------------------------------

>Comment By: Charlie Savage (cfis)
Date: 2008-07-09 11:39

Message:
This now works as expected.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=11766&group_id=494
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to