From 4a753dbefc2e67c218cf41141eaa6afab00f774a Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 23 Aug 2021 11:04:21 +0000 Subject: Fix a few memory leaks. --- cmd-parse.y | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cmd-parse.y') diff --git a/cmd-parse.y b/cmd-parse.y index c27d530e..a08c5819 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -426,7 +426,7 @@ command : assignment arg = xcalloc(1, sizeof *arg); arg->type = CMD_PARSE_STRING; - arg->string = xstrdup($2); + arg->string = $2; TAILQ_INSERT_HEAD(&$$->arguments, arg, entry); } | optional_assignment TOKEN arguments @@ -443,7 +443,7 @@ command : assignment arg = xcalloc(1, sizeof *arg); arg->type = CMD_PARSE_STRING; - arg->string = xstrdup($2); + arg->string = $2; TAILQ_INSERT_HEAD(&$$->arguments, arg, entry); } @@ -543,13 +543,13 @@ argument : TOKEN { $$ = xcalloc(1, sizeof *$$); $$->type = CMD_PARSE_STRING; - $$->string = xstrdup($1); + $$->string = $1; } | EQUALS { $$ = xcalloc(1, sizeof *$$); $$->type = CMD_PARSE_STRING; - $$->string = xstrdup($1); + $$->string = $1; } | '{' argument_statements { @@ -817,7 +817,6 @@ cmd_parse_build_command(struct cmd_parse_command *cmd, goto out; values[count].type = ARGS_COMMANDS; values[count].cmdlist = pr->cmdlist; - values[count].cmdlist->references++; break; } count++; -- cgit v1.2.3