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

Commit

Permalink
Avoid accessing T_NONE object in rxml_node_deregisterNode
Browse files Browse the repository at this point in the history
Doing so causes segfault.

sparklemotion/nokogiri#881 (comment)
  • Loading branch information
yujinakayama committed Sep 9, 2015
1 parent d4a7298 commit 4141b4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/libxml/ruby_xml_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ static void rxml_node_deregisterNode(xmlNodePtr xnode)
then disable the dfree function so that Ruby will not
try to free the node a second time. */
VALUE node = (VALUE) xnode->_private;

if (TYPE(node) == T_NONE) {
return;
}

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

0 comments on commit 4141b4d

Please sign in to comment.