From: Ulya Trofimovich Date: Thu, 22 Dec 2016 16:53:41 +0000 (+0000) Subject: Fixed memleaks (found by valgrind). X-Git-Tag: 1.0~39^2~169 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=141ddd09e8e1ab0da580db1402f539a7eb3ac940;p=re2c Fixed memleaks (found by valgrind). --- diff --git a/re2c/bootstrap/src/parse/lex.cc b/re2c/bootstrap/src/parse/lex.cc index 0884fbee..7f41cc58 100644 --- a/re2c/bootstrap/src/parse/lex.cc +++ b/re2c/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Thu Dec 22 14:38:33 2016 */ +/* Generated by re2c 0.16 on Thu Dec 22 16:22:48 2016 */ #line 1 "../src/parse/lex.re" #include "src/util/c99_stdint.h" #include diff --git a/re2c/bootstrap/src/parse/parser.cc b/re2c/bootstrap/src/parse/parser.cc index c0086d2e..3eb034cb 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -198,19 +198,18 @@ static void make_rule(Scanner &in, CondList *clist, RegExpRule *rule, delete clist; } -static void make_setup(Scanner &in, CondList *clist, const Code * code) +static void make_setup(Scanner &in, CondList *clist, const Code *code) { assert(clist); assert(code); context_check(in, clist); - for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it) - { - if (ruleSetupMap.find(*it) != ruleSetupMap.end()) - { - in.fatalf_at(code->fline, "code to setup rule '%s' is already defined", it->c_str()); + for (CondList::const_iterator i = clist->begin(); i != clist->end(); ++i) { + if (ruleSetupMap.find(*i) != ruleSetupMap.end()) { + in.fatalf_at(code->fline, "code to setup rule '%s' is already defined", i->c_str()); } - ruleSetupMap[*it] = std::make_pair(code->fline, code->text); + ruleSetupMap[*i] = std::make_pair(code->fline, code->text); } + delete code; delete clist; } @@ -593,11 +592,11 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 199, 199, 201, 202, 203, 207, 214, 219, 222, - 226, 226, 229, 233, 237, 241, 245, 249, 253, 257, - 262, 268, 275, 276, 280, 284, 289, 294, 298, 305, - 309, 316, 320, 327, 331, 348, 367, 371, 375, 379, - 386, 396, 400 + 0, 198, 198, 200, 201, 202, 206, 213, 218, 221, + 225, 225, 228, 232, 236, 240, 244, 248, 252, 256, + 261, 267, 274, 275, 279, 283, 288, 293, 297, 304, + 308, 315, 319, 326, 330, 347, 366, 370, 374, 378, + 385, 395, 399 }; #endif diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index 6998f1e2..35375ada 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -130,19 +130,18 @@ static void make_rule(Scanner &in, CondList *clist, RegExpRule *rule, delete clist; } -static void make_setup(Scanner &in, CondList *clist, const Code * code) +static void make_setup(Scanner &in, CondList *clist, const Code *code) { assert(clist); assert(code); context_check(in, clist); - for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it) - { - if (ruleSetupMap.find(*it) != ruleSetupMap.end()) - { - in.fatalf_at(code->fline, "code to setup rule '%s' is already defined", it->c_str()); + for (CondList::const_iterator i = clist->begin(); i != clist->end(); ++i) { + if (ruleSetupMap.find(*i) != ruleSetupMap.end()) { + in.fatalf_at(code->fline, "code to setup rule '%s' is already defined", i->c_str()); } - ruleSetupMap[*it] = std::make_pair(code->fline, code->text); + ruleSetupMap[*i] = std::make_pair(code->fline, code->text); } + delete code; delete clist; }