diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-19 12:32:10 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-19 12:32:10 +0300 |
commit | 257a0bf128e109442dce91c4aaa1d97fed17ad1a (patch) | |
tree | 8880d3e260d6f18e7d9c7935b7886807db510fe3 /src/goto-commands.c | |
parent | 2b92178287efe3b53237e9d61c69a4bf350c716d (diff) | |
download | sciteco-257a0bf128e109442dce91c4aaa1d97fed17ad1a.tar.gz |
fixed leaking data on rubout
* Objects, that are restored with TECO_DEFINE_UNDO_OBJECT_OWN(),
could actually leak memory on rubout since the old object was not
deleted when overwriting it.
* Now that it is, it is crucial to at least nullify objects/pointers
after calling the corresponding push-function.
These conditions are now explicitly documented.
* The test suite now runs successfully under Valgrind even with full leak checking.
Diffstat (limited to 'src/goto-commands.c')
-rw-r--r-- | src/goto-commands.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/goto-commands.c b/src/goto-commands.c index d463151..bf5743e 100644 --- a/src/goto-commands.c +++ b/src/goto-commands.c @@ -90,6 +90,8 @@ teco_state_label_input(teco_machine_main_t *ctx, gunichar chr, GError **error) teco_undo_string_own(ctx->goto_label); else teco_string_clear(&ctx->goto_label); + memset(&ctx->goto_label, 0, sizeof(ctx->goto_label)); + return &teco_state_start; } |