From 68578324292871b752c34221f24d429f725ba9cd Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sun, 15 May 2016 17:49:52 +0100 Subject: [PATCH] Fixed occasional double-freeing tag names. Tag names belong to regexps, which may be shared between automata, so names should be freed on regexp destruction, not on automata destruction. --- re2c/src/ir/regexp/regexp.h | 3 +++ re2c/src/ir/tag.cc | 5 ----- re2c/src/ir/tag.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/re2c/src/ir/regexp/regexp.h b/re2c/src/ir/regexp/regexp.h index 9440a743..1244a4d9 100644 --- a/re2c/src/ir/regexp/regexp.h +++ b/re2c/src/ir/regexp/regexp.h @@ -80,6 +80,9 @@ struct RegExp inline ~RegExp() { flist.erase(this); + if (type == TAG) { + delete tag; + } } private: diff --git a/re2c/src/ir/tag.cc b/re2c/src/ir/tag.cc index b7a2bf31..6e49d7ea 100644 --- a/re2c/src/ir/tag.cc +++ b/re2c/src/ir/tag.cc @@ -14,11 +14,6 @@ Tag::Tag() , name(NULL) {} -Tag::~Tag() -{ - delete name; -} - void init_var_tag(Tag &tag, size_t r, const std::string *n, size_t o) { tag.type = Tag::VAR; diff --git a/re2c/src/ir/tag.h b/re2c/src/ir/tag.h index bb193b48..bfe0ab4c 100644 --- a/re2c/src/ir/tag.h +++ b/re2c/src/ir/tag.h @@ -29,7 +29,6 @@ struct Tag }; Tag(); - ~Tag(); FORBID_COPY(Tag); }; -- 2.40.0