Bug 1245737 (part 0) - Fix a leak in DtoaState. r=sfink.

DtoaState has a field |p5s| that stores a linked list of Bigints which never
gets freed. This patch adds freeing code for it to destroydtoa().

This has never shown up before because DtoaState currently uses a private chunk
for allocations instead of malloc/free and that private chunk does get freed.
But the next patch will turn off the use of that private chunk so we now need
to free |p5s| so that ASAN doesn't complain.

The new code follows the bizarre local style used by dtoa.c.
This commit is contained in:
Nicholas Nethercote 2016-02-10 17:17:56 +11:00
parent 4466c805b1
commit bf1676291b

View File

@ -526,6 +526,14 @@ destroydtoa
FREE((void*)v);
}
}
#ifdef Omit_Private_Memory
Bigint* p5 = GET_STATE(p5s);
while (p5) {
Bigint* tmp = p5;
p5 = p5->next;
FREE(tmp);
}
#endif
FREE((void *)state);
}