]> granicus.if.org Git - onig/commitdiff
add ENCLOSURE_IF_ELSE case into onig_node_free()
authorK.Kosako <kosako@sofnec.co.jp>
Wed, 5 Jul 2017 07:31:14 +0000 (16:31 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 5 Jul 2017 07:31:14 +0000 (16:31 +0900)
src/regparse.c

index 0351ae91fe45f356b8fb6ef92f3ef7fc936e4072..fafd02c2256ffd19d5f105ff0866a70c686ad081 100644 (file)
@@ -1109,8 +1109,20 @@ onig_node_free(Node* node)
       xfree(BACKREF_(node)->back_dynamic);
     break;
 
-  case NODE_QUANT:
   case NODE_ENCLOSURE:
+    if (NODE_BODY(node))
+      onig_node_free(NODE_BODY(node));
+
+    {
+      EnclosureNode* en = ENCLOSURE_(node);
+      if (en->type == ENCLOSURE_IF_ELSE) {
+        onig_node_free(en->te.Then);
+        onig_node_free(en->te.Else);
+      }
+    }
+    break;
+
+  case NODE_QUANT:
   case NODE_ANCHOR:
     if (NODE_BODY(node))
       onig_node_free(NODE_BODY(node));