fixed a crash when lines start with whitespace

This commit is contained in:
Johann Glaser 2013-03-18 20:58:47 +01:00
parent 2192873daa
commit 15ad2db8fc
1 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,7 @@ void Pass::extra_args(std::vector<std::string> args, size_t argidx, RTLIL::Desig
void Pass::call(RTLIL::Design *design, std::string command) void Pass::call(RTLIL::Design *design, std::string command)
{ {
std::vector<std::string> args; std::vector<std::string> args;
char *s = strdup(command.c_str()), *saveptr; char *s = strdup(command.c_str()), *sstart = s, *saveptr;
s += strspn(s, " \t\r\n"); s += strspn(s, " \t\r\n");
if (*s == 0 || *s == '#') if (*s == 0 || *s == '#')
return; return;
@ -160,7 +160,7 @@ void Pass::call(RTLIL::Design *design, std::string command)
} else } else
args.push_back(str); args.push_back(str);
} }
free(s); free(sstart);
call(design, args); call(design, args);
} }