diff --git a/tools/binpac/src/pac_regex.cc b/tools/binpac/src/pac_regex.cc index 6265c02876..1d01556bd6 100644 --- a/tools/binpac/src/pac_regex.cc +++ b/tools/binpac/src/pac_regex.cc @@ -10,7 +10,7 @@ const char *RegEx::kMatchPrefix = "MatchPrefix"; string escape_char(const string &s) { - char buf[s.length() * 2 + 1]; + char* buf = new char[s.length() * 2 + 1]; int j = 0; for ( int i = 0; i < (int) s.length(); ++i ) { @@ -40,7 +40,9 @@ string escape_char(const string &s) buf[j++] = '\0'; - return string(buf); + string rval = buf; + delete [] buf; + return rval; } RegEx::RegEx(const string &s)