[Cryptech-Commits] [user/ft/libcli] 01/03: cli_parse_line: get rid of a lingering strdup
git at cryptech.is
git at cryptech.is
Tue May 31 13:09:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
fredrik at thulin.net pushed a commit to branch master
in repository user/ft/libcli.
commit 565a5379d73a8492d247fdd41773096d83fbf941
Author: Fredrik Thulin <fredrik at thulin.net>
AuthorDate: Mon May 30 14:50:45 2016 +0200
cli_parse_line: get rid of a lingering strdup
---
libcli.c | 5 +++--
1 file 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;
More information about the Commits
mailing list