File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1693,7 +1693,9 @@ namespace simplecpp {
1693
1693
nameTokDef = nametoken;
1694
1694
variadic = false ;
1695
1695
variadicOpt = false ;
1696
+ delete optExpandValue;
1696
1697
optExpandValue = nullptr ;
1698
+ delete optNoExpandValue;
1697
1699
optNoExpandValue = nullptr ;
1698
1700
if (!nameTokDef) {
1699
1701
valueToken = endToken = nullptr ;
@@ -2367,8 +2369,8 @@ namespace simplecpp {
2367
2369
bool variadicOpt;
2368
2370
2369
2371
/* * Expansion value for varadic macros with __VA_OPT__ expanded and discarded respectively */
2370
- const TokenList *optExpandValue;
2371
- const TokenList *optNoExpandValue;
2372
+ const TokenList *optExpandValue{} ;
2373
+ const TokenList *optNoExpandValue{} ;
2372
2374
2373
2375
/* * was the value of this macro actually defined in the code? */
2374
2376
bool valueDefinedInCode_;
Original file line number Diff line number Diff line change @@ -3231,6 +3231,15 @@ static void fuzz_crash()
3231
3231
}
3232
3232
}
3233
3233
3234
+ static void leak ()
3235
+ {
3236
+ {
3237
+ const char code[] = " #define e(...)__VA_OPT__()\n "
3238
+ " #define e\n " ;
3239
+ (void )preprocess (code, simplecpp::DUI ());
3240
+ }
3241
+ }
3242
+
3234
3243
int main (int argc, char **argv)
3235
3244
{
3236
3245
TEST_CASE (backslash);
@@ -3487,5 +3496,7 @@ int main(int argc, char **argv)
3487
3496
3488
3497
TEST_CASE (fuzz_crash);
3489
3498
3499
+ TEST_CASE (leak);
3500
+
3490
3501
return numberOfFailedAssertions > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
3491
3502
}
You can’t perform that action at this time.
0 commit comments