summaryrefslogtreecommitdiffstats
path: root/cmd-parse.y
diff options
context:
space:
mode:
authornicm <nicm>2021-08-23 11:04:21 +0000
committernicm <nicm>2021-08-23 11:04:21 +0000
commit4a753dbefc2e67c218cf41141eaa6afab00f774a (patch)
tree6a52781c86c30894be0e2161c31154b3bdf953a0 /cmd-parse.y
parent3ed37a207988bc6e96dc673ae4564a4efd682ea6 (diff)
Fix a few memory leaks.
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y9
1 files changed, 4 insertions, 5 deletions
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++;