File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ int main(int argc, char **argv) {
4141
4242 if (*args == NULL ) {
4343 print_help (argv[0 ]);
44+ delete rules;
4445 return 0 ;
4546 }
4647
@@ -50,6 +51,7 @@ int main(int argc, char **argv) {
5051 const char *arg = *args;
5152 std::string err;
5253 int r;
54+ bool need_free = false ;
5355
5456 if (argFull.empty () == false ) {
5557 if (arg[strlen (arg)-1 ] == ' \" ' ) {
@@ -72,6 +74,7 @@ int main(int argc, char **argv) {
7274
7375 if (argFull.empty () == false ) {
7476 arg = strdup (argFull.c_str ());
77+ need_free = true ;
7578 argFull.clear ();
7679 }
7780
@@ -81,6 +84,9 @@ int main(int argc, char **argv) {
8184 } else {
8285 r = rules->load (arg);
8386 }
87+ if (need_free == true && arg != nullptr ) {
88+ free ((void *)arg);
89+ }
8490 if (r < 0 ) {
8591 err.assign (rules->m_parserError .str ());
8692 rules->m_parserError .str (" " );
You can’t perform that action at this time.
0 commit comments