From 93f61120ddba2093d85dbd09dff2deb42f0393e2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 13 Apr 2025 20:44:02 +0300 Subject: 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. --- tecundo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tecundo.c') diff --git a/tecundo.c b/tecundo.c index 927cea3..9dd5feb 100644 --- a/tecundo.c +++ b/tecundo.c @@ -368,11 +368,7 @@ register struct undo_token *ut; ut = (struct undo_token *)tec_alloc(TYPE_C_UNDO,sizeof(struct undo_token)); if(ut == NULL) return(NULL); - ut->opcode = UNDO_C_UNUSED; - ut->iarg1 = 0; - ut->iarg2 = 0; - ut->carg1 = NULL; - ut->next_token = NULL; + memset(ut,0,sizeof(*ut)); if(ct != NULL){ ut->next_token = ct->undo_list; -- cgit v1.2.3