Freed defers after they run. Apparently this is sufficient to satisfy AddressSanitizer, which... how? I'll take it, but still, there's definitely more unfreed allocations than this...
This commit is contained in:
parent
ddaa10b7e1
commit
6d6cd66046
|
@ -111,6 +111,13 @@ static void runDefers(testingT *t)
|
|||
t->defersRun = true;
|
||||
for (d = t->defers; d != NULL; d = d->next)
|
||||
(*(d->f))(t, d->data);
|
||||
// and now free the defers
|
||||
// we could use t->defers == NULL instead of t->defersRun but then recursive calls to runDefers() (for instance, if a deferred function calls testingTFatalf()) would explode
|
||||
while (t->defers != NULL) {
|
||||
d = t->defers;
|
||||
t->defers = t->defers->next;
|
||||
testingprivFree(d);
|
||||
}
|
||||
}
|
||||
|
||||
static const testingOptions defaultOptions = {
|
||||
|
|
Loading…
Reference in New Issue