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:
parent
a84caa72b0
commit
36dc2e6885
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user