aboutsummaryrefslogtreecommitdiff
path: root/tecparse.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-04-13 20:44:02 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-04-21 20:49:37 +0300
commit93f61120ddba2093d85dbd09dff2deb42f0393e2 (patch)
tree84daad494628537c5bd2f93ef216029590ed0e01 /tecparse.c
parent278cc757b3146be68376318999415b97220c4d92 (diff)
downloadvideoteco-fork-93f61120ddba2093d85dbd09dff2deb42f0393e2.tar.gz
properly initialize all allocated structures
* Fixes access to uninitialized field in cmd_token, as found via Valgrind. * Possibly other structures also aren't fully initialized, so I memset() them as well.
Diffstat (limited to 'tecparse.c')
-rw-r--r--tecparse.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/tecparse.c b/tecparse.c
index 90d4b5f..e726ea6 100644
--- a/tecparse.c
+++ b/tecparse.c
@@ -1303,21 +1303,8 @@ register struct cmd_token *ct;
* We set up the initial state to be that of an empty token, with fields
* which are not set up yet set to their proper defaults.
*/
- ct->opcode = TOK_C_UNUSED;
- ct->ctx.iarg1_flag = ct->ctx.iarg2_flag = NO;
- ct->ctx.iarg1 = ct->ctx.iarg2 = 0;
- ct->ctx.carg = NULL;
- ct->next_token = NULL;
- ct->undo_list = NULL;
- ct->execute_state = 0;
- ct->flags = 0;
+ memset(ct,0,sizeof(*ct));
- ct->prev_token = NULL;
- ct->ctx.state = 0;
- ct->ctx.go_flag = NO;
- ct->ctx.return_state = 0;
- ct->ctx.caller_token = NULL;
- ct->ctx.pnest = ct->ctx.inest = ct->ctx.cnest = 0;
/*
* If there was an old token specified, two things must happen. First, we
* have to link the new token onto the old token list. Second, we have to