From c9345b8aa0f7e4cf5bd30ede4138cab68b4bd938 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 7 Jun 2025 15:38:48 +0300 Subject: initialize some variables in teco_state_expectqreg_input() to silence the Clang static analyzer There was the possibility that an unitialized value is passed into a got_register_cb(). This could only happen in normal parse mode and it's unlikely to have caused problems in practice as all callbacks should not rely on qreg being valid in parse-only mode. This sort of bug would have also been catched by Valgrind. The rest of the scan-build-reported warnings are bogus (caused by not being g_auto-aware). --- src/qreg-commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qreg-commands.c b/src/qreg-commands.c index a3caad0..09c3549 100644 --- a/src/qreg-commands.c +++ b/src/qreg-commands.c @@ -54,8 +54,8 @@ teco_state_expectqreg_input(teco_machine_main_t *ctx, gunichar chr, GError **err { teco_state_t *current = ctx->parent.current; - teco_qreg_t *qreg; - teco_qreg_table_t *table; + teco_qreg_t *qreg = NULL; + teco_qreg_table_t *table = NULL; switch (teco_machine_qregspec_input(ctx->expectqreg, chr, ctx->flags.mode == TECO_MODE_NORMAL ? &qreg : NULL, &table, error)) { -- cgit v1.2.3