From 257a0bf128e109442dce91c4aaa1d97fed17ad1a Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 19 Mar 2025 12:32:10 +0300 Subject: 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. --- src/qreg.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qreg.c') diff --git a/src/qreg.c b/src/qreg.c index 4beea74..1b97689 100644 --- a/src/qreg.c +++ b/src/qreg.c @@ -1708,6 +1708,8 @@ teco_machine_qregspec_auto_complete(teco_machine_qregspec_t *ctx, teco_string_t void teco_machine_qregspec_free(teco_machine_qregspec_t *ctx) { + if (!ctx) + return; teco_machine_stringbuilding_clear(&ctx->machine_stringbuilding); teco_string_clear(&ctx->name); g_free(ctx); -- cgit v1.2.3