Follow-up Comment #29, bug #68145 (group groff):
commit 95d2d0a2504e8131a251a9142fd39eca3e453847 Author: G. Branden Robinson <[email protected]> Date: Thu Mar 19 08:41:10 2026 -0500 [grotty]: Avoid leaking memory. * src/devices/grotty/tty.cpp (tty_printer::end_page): Further simplify new dynamic memory management strategy to avoid memory leaks. Always `delete[]` (free) the `lines` array at the end of a page, regardless of the value of `nlines`. Comparing the latter's value to `default_lines_per_page` was a naïve technique. First, reducing the page length _below_ the default would also cause a reallocation, so it needs to be freed. Second, if the input document resized the page multiple times, with the final value being equal to `default_lines_per_page`, we would similarly wrongly skip the `delete[]`. Since `begin_page()` _always_ allocates storage with `new` and `add_char()` _always_ reallocates it with `new` (and deletes the old one) in the event of a resize, we can (and should) _always_ delete the storage allocated to `lines` at the end of a page. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?68145> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature
