Sync OpenBSD patchset 1012:

Fix memory leak in error path, from Tiago Cunha.
This commit is contained in:
Tiago Cunha 2012-01-29 12:51:43 +00:00
parent ad2cc63412
commit c846298747

View File

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