mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-25 08:09:24 +01:00
Sync OpenBSD patchset 1012:
Fix memory leak in error path, from Tiago Cunha.
This commit is contained in:
parent
ad2cc63412
commit
c846298747
3
status.c
3
status.c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user