From 3a2583e918bcc805fe860252f8a520fc2f9b26ce Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 18 Jul 2025 00:34:56 +0300 Subject: fixed minor memory leaks of per-state data in teco_machine_main_t * These were leaked e.g. in case of end-of-macro errors, but also in case of syntax highlighting (teco_lexer_style()). I considered to solve this by overwriting more of the end_of_macro_cb, but it didn't turn out to be trivial always. * Considering that the union in teco_machine_main_t saved only 3 machine words of memory, I decided to sacrifice those for more robust memory management. * teco_machine_qregspec_t cannot be directly embedded into teco_machine_main_t due to recursive dependencies with teco_machine_stringbuilding_t. It could now and should perhaps be allocated only once in teco_machine_main_init(), but it would require more refactoring. --- tests/testsuite.at | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 8d4daa7..a5fa98e 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -228,6 +228,14 @@ TE_CHECK([[@^Ua{@EQ.x//} Ma @^U.x/FOO/]], 1, ignore, ignore) TE_CHECK([[@^Ua{@EQ.x// Mb Q*U*} Ma]], 0, ignore, ignore) AT_CLEANUP +# This is also for detecting leaks under Valgrind. +AT_SETUP([Unterminated commands]) +TE_CHECK([[G[foo^Q] ]], 1, ignore, ignore) +TE_CHECK([[!foo ]], 1, ignore, ignore) +TE_CHECK([[^Ua ]], 1, ignore, ignore) +TE_CHECK([[EGa ]], 1, ignore, ignore) +AT_CLEANUP + AT_SETUP([Loading files into Q-Registers]) TE_CHECK([[@I/../ @EW/loadqreg.txt/ @EQa/loadqreg.txt/ :Qa-2"N(0/0)']], 0, ignore, ignore) # Does the same as FG..$. Afterwards, the parent directory should be shorter. @@ -409,6 +417,8 @@ TE_CHECK([[@EU$"."]], 0, ignore, ignore) AT_CLEANUP AT_SETUP([Empty help topic]) +# FIXME: Produces a false positive under Valgrind +# due to the value of $SCITECOPATH. TE_CHECK([[@?//]], 1, ignore, ignore) AT_CLEANUP -- cgit v1.2.3