Fix memory leak in error path, from Tiago Cunha.

This commit is contained in:
Nicholas Marriott 2012-01-26 09:03:09 +00:00
parent 678e67437f
commit d2d2df1365

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;