aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Thulin <fredrik@thulin.net>2016-05-30 14:50:45 +0200
committerFredrik Thulin <fredrik@thulin.net>2016-05-30 14:50:45 +0200
commit565a5379d73a8492d247fdd41773096d83fbf941 (patch)
tree539b64046f75d7a6913faf0c984c2620a1786a83
parent10893783fbcee4db76e620c7f2576cdddd0e9ef4 (diff)
cli_parse_line: get rid of a lingering strdup
-rw-r--r--libcli.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libcli.c b/libcli.c
index cdf895c..b069c28 100644
--- a/libcli.c
+++ b/libcli.c
@@ -540,8 +540,9 @@ static int cli_parse_line(const char *line, char *words[], int max_words)
{
if (*p == '|')
{
- if (!(words[nwords++] = strdup("|")))
- return 0;
+ *ptr = '|';
+ words[nwords++] = ptr;
+ ptr += 1 + 1; /* buf is memset zero, so we just need to add +1 to get a null terminated word */
}
else if (!isspace((unsigned char) *p))
word_start = p;