aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-06-07 15:38:48 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-06-07 15:38:48 +0300
commitc9345b8aa0f7e4cf5bd30ede4138cab68b4bd938 (patch)
treec956785a09bbcb176182999addff55e4e24b3e0c /src
parent59d1188feb5c037eeffe6ba782ab362d2bb46a2d (diff)
downloadsciteco-c9345b8aa0f7e4cf5bd30ede4138cab68b4bd938.tar.gz
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).
Diffstat (limited to 'src')
-rw-r--r--src/qreg-commands.c4
1 files 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)) {