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) {
41
41
42
42
if (*args == NULL ) {
43
43
print_help (argv[0 ]);
44
+ delete rules;
44
45
return 0 ;
45
46
}
46
47
@@ -50,6 +51,7 @@ int main(int argc, char **argv) {
50
51
const char *arg = *args;
51
52
std::string err;
52
53
int r;
54
+ bool need_free = false ;
53
55
54
56
if (argFull.empty () == false ) {
55
57
if (arg[strlen (arg)-1 ] == ' \" ' ) {
@@ -72,6 +74,7 @@ int main(int argc, char **argv) {
72
74
73
75
if (argFull.empty () == false ) {
74
76
arg = strdup (argFull.c_str ());
77
+ need_free = true ;
75
78
argFull.clear ();
76
79
}
77
80
@@ -81,6 +84,9 @@ int main(int argc, char **argv) {
81
84
} else {
82
85
r = rules->load (arg);
83
86
}
87
+ if (need_free == true && arg != nullptr ) {
88
+ free ((void *)arg);
89
+ }
84
90
if (r < 0 ) {
85
91
err.assign (rules->m_parserError .str ());
86
92
rules->m_parserError .str (" " );
You can’t perform that action at this time.
0 commit comments