Memory leak in preprocessor - indirect invocation of macro with incorrect number of arguments
ehaas opened this issue · comments
Evan Haas commented
Using the following test case in the test runner causes a memory leak
#define NO_ERROR_VALIDATION
#define h(x) x(0)
#define s()
h(s)
error(gpa): memory address 0x10c89f500 leaked:
/Users/ehaas/local/zig-macos-x86_64-0.13.0-dev.44+9d64332a5/lib/std/array_list.zig:457:67: 0x1061a8903 in ensureTotalCapacityPrecise (test-runner)
const new_memory = try self.allocator.alignedAlloc(T, alignment, new_capacity);
^
/Users/ehaas/local/zig-macos-x86_64-0.13.0-dev.44+9d64332a5/lib/std/array_list.zig:434:51: 0x106124c0e in ensureTotalCapacity (test-runner)
return self.ensureTotalCapacityPrecise(better_capacity);
^
/Users/ehaas/source/arocc/src/aro/Tree.zig:67:37: 0x106124451 in addExpansionLocation (test-runner)
try list.ensureTotalCapacity(wanted_len);
^
/Users/ehaas/source/arocc/src/aro/Tree.zig:86:38: 0x1061fbc50 in dupe (test-runner)
try copy.addExpansionLocation(gpa, tok.expansionSlice());
^
/Users/ehaas/source/arocc/src/aro/Preprocessor.zig:2110:43: 0x1061fd155 in collectMacroFuncArguments (test-runner)
const duped = try tok.dupe(pp.gpa);
^
/Users/ehaas/source/arocc/src/aro/Preprocessor.zig:2211:62: 0x10619a204 in expandMacroExhaustive (test-runner)
const args = pp.collectMacroFuncArguments(
^