Closed yparitcher closed 4 years ago
When calling fbink_free_ot_fonts() twice there is a double free. for example:
fbink_free_ot_fonts()
fbink_add_ot_font("font.ttf", FNT_REGULAR); fbink_free_ot_fonts(); ... fbink_add_ot_font("font.ttf", FNT_REGULAR); fbink_free_ot_fonts();
in a long running program.
https://github.com/NiLuJe/FBInk/blob/5642e16cd9859c9e815322f82626232396ecbdc5/fbink.c#L2720 only nulls the local copy of font_info however the global pointer otFonts.otRegular is not nulled, which leaves a dangling pointer -> double free.
font_info
otFonts.otRegular
I am not sure how to pass the pointer to fix this. Thanks
Whoops.
Nice catch, and thanks for the PR, which I'll apply shortly, as that was the exact same thing I was going to try ;).
When calling
fbink_free_ot_fonts()
twice there is a double free. for example:in a long running program.
https://github.com/NiLuJe/FBInk/blob/5642e16cd9859c9e815322f82626232396ecbdc5/fbink.c#L2720 only nulls the local copy of
font_info
however the global pointerotFonts.otRegular
is not nulled, which leaves a dangling pointer -> double free.I am not sure how to pass the pointer to fix this. Thanks