mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-24 09:05:48 -04:00
term: reset: fix reset of the VT struct
1. Free buffers and strings 2. memset() the vt struct 3. re-initialize members that must not be zero We _could_ replace the memset() with explicit zeroing of all the members. It’s just that there’s a lot of arrays, so this is much easier. Closes #495
This commit is contained in:
parent
bd8c936b00
commit
bfd3eb47ec
2 changed files with 8 additions and 6 deletions
|
|
@ -81,6 +81,9 @@
|
||||||
resulting in PGO build failures.
|
resulting in PGO build failures.
|
||||||
* Wrong colors in the 256-color cube
|
* Wrong colors in the 256-color cube
|
||||||
(https://codeberg.org/dnkl/foot/issues/479).
|
(https://codeberg.org/dnkl/foot/issues/479).
|
||||||
|
* Memory leak triggered by “opening” an OSC-8 URI and then resetting
|
||||||
|
the terminal without closing the URI
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/495).
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
11
terminal.c
11
terminal.c
|
|
@ -1649,13 +1649,12 @@ term_reset(struct terminal *term, bool hard)
|
||||||
term->scroll_region.start = 0;
|
term->scroll_region.start = 0;
|
||||||
term->scroll_region.end = term->rows;
|
term->scroll_region.end = term->rows;
|
||||||
|
|
||||||
free(term->vt.osc.data);
|
|
||||||
memset(&term->vt, 0, sizeof(term->vt));
|
|
||||||
term->vt.state = 0; /* GROUND */
|
|
||||||
|
|
||||||
term->vt.osc8.begin = (struct coord){-1, -1};
|
|
||||||
free(term->vt.osc8.uri);
|
free(term->vt.osc8.uri);
|
||||||
term->vt.osc8.uri = NULL;
|
free(term->vt.osc.data);
|
||||||
|
|
||||||
|
memset(&term->vt, 0, sizeof(term->vt));
|
||||||
|
term->vt.state = 0; /* STATE_GROUND */
|
||||||
|
term->vt.osc8.begin = (struct coord){-1, -1};
|
||||||
|
|
||||||
if (term->grid == &term->alt) {
|
if (term->grid == &term->alt) {
|
||||||
term->grid = &term->normal;
|
term->grid = &term->normal;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue