The initial logic for allocating the new string was wrong, the conversion

to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
to allocate the new string.
This commit is contained in:
Baptiste Daroussin 2015-05-10 10:15:36 +00:00
parent a84caa72b0
commit 36dc2e6885
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282719

View File

@ -213,15 +213,12 @@ char *
newstr(char const * p)
{
char *q;
size_t l;
if ((p = unquote(p)) == NULL)
return (NULL);
l = strlen(p) + 1;
if ((q = strndup(p, l)) == NULL)
err(1, "strndup()");
if ((q = strdup(p)) == NULL)
err(1, "strdup()");
return (q);
}