fixed a crash when lines start with whitespace
authorJohann Glaser <Johann.Glaser@gmx.at>
Mon, 18 Mar 2013 19:58:47 +0000 (20:58 +0100)
committerJohann Glaser <Johann.Glaser@gmx.at>
Mon, 18 Mar 2013 19:58:47 +0000 (20:58 +0100)
kernel/register.cc

index ebb834c8f7a003e0c5c864c0dc292eb65e75f3fd..a61548b6478f959503fa9fac4a4258baf35cc79b 100644 (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)
 {
        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");
        if (*s == 0 || *s == '#')
                return;
@@ -160,7 +160,7 @@ void Pass::call(RTLIL::Design *design, std::string command)
                } else
                        args.push_back(str);
        }
-       free(s);
+       free(sstart);
        call(design, args);
 }