thutt / lrstar

Port of lrstar parser generator to Linux
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Memory leak #10

Open mingodad opened 1 week ago

mingodad commented 1 week ago

There is still one memory leak from C_user_main.cpp for the strdup in this line opts->output = strdup(optarg); bellow is a fix for it.

-------------------------- src/lrstar/PG_Generate.cpp --------------------------
index d72b551..a262076 100644
@@ -2561,6 +2561,7 @@ static void instantiate_main(FILE *fp, const char *grammar)
            "        delete [] input_start;\n"
            "    }\n\n"
            "    fclose(output_fp);\n"
+           "    free(options.output);\n"
            "    return 0;\n"
            "}\n"
            "\n");