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:
Pietro Gagliardi 2019-06-02 14:05:36 -04:00
parent ddaa10b7e1
commit 6d6cd66046
1 changed files with 7 additions and 0 deletions

View File

@ -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 = {