Sync OpenBSD patchset 1012:

Fix memory leak in error path, from Tiago Cunha.
pull/1/head
Tiago Cunha 2012-01-29 12:51:43 +00:00
parent ad2cc63412
commit c846298747
1 changed files with 2 additions and 1 deletions

View File

@ -462,12 +462,13 @@ do_replace:
ptrlen = limit;
if (*optr + ptrlen >= out + outsize - 1)
return;
goto out;
while (ptrlen > 0 && *ptr != '\0') {
*(*optr)++ = *ptr++;
ptrlen--;
}
out:
if (freeptr != NULL)
xfree(freeptr);
return;