Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
Avoid touching non-LibXML objects in rxml_node_deregisterNode
Browse files Browse the repository at this point in the history
  • Loading branch information
yujinakayama committed Sep 10, 2015
1 parent 37d3ee4 commit da19c3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/libxml/ruby_xml_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <assert.h>

VALUE cXMLNode;
const char* kLibXMLNamespace = "LibXML::";

/* Document-class: LibXML::XML::Node
*
Expand Down Expand Up @@ -54,6 +55,11 @@ static void rxml_node_deregisterNode(xmlNodePtr xnode)
return;
}

const char* className = rb_obj_classname(node);
if (strncmp(className, kLibXMLNamespace, strlen(kLibXMLNamespace)) != 0) {
return;
}

RDATA(node)->data = NULL;
RDATA(node)->dfree = NULL;
RDATA(node)->dmark = NULL;
Expand Down

0 comments on commit da19c3f

Please sign in to comment.