summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2009-12-14 21:15:55 +0000
committerstsp <stsp@openbsd.org>2009-12-14 21:15:55 +0000
commit7f7ccb8414ddec1667293fad53269a7478a3a10d (patch)
tree66127f598191a5fc89528f7cf2faa754e04e1142
parentFix previous commit. I left out a small fragment and accidentally committed (diff)
downloadwireguard-openbsd-7f7ccb8414ddec1667293fad53269a7478a3a10d.tar.xz
wireguard-openbsd-7f7ccb8414ddec1667293fad53269a7478a3a10d.zip
Fix "cvs [update aborted]: out of memory; can not reallocate 5242880 bytes"
when checking out xenocara from a server running OpenBSD/amd64. While processing RCS deltas, don't allocate twice as much memory as needed when copying a line vector to a vector which has less lines. Also, when switching back from a branch to trunk while searching an RCS file for a revision, free the trunklines vector immediately after lines saved in it have been copied back into the currentlines vector. Somehow, these two changes together make the problem go away. ok tobias@, "this has been a serious annoyance" sthen@, "sure" deraadt@
-rw-r--r--gnu/usr.bin/cvs/src/rcs.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c
index 4260952e10e..6b003353e51 100644
--- a/gnu/usr.bin/cvs/src/rcs.c
+++ b/gnu/usr.bin/cvs/src/rcs.c
@@ -6758,10 +6758,7 @@ linevector_copy (to, from)
}
if (from->nlines > to->lines_alloced)
{
- if (to->lines_alloced == 0)
- to->lines_alloced = 10;
- while (from->nlines > to->lines_alloced)
- to->lines_alloced *= 2;
+ to->lines_alloced = from->nlines;
to->vector = (struct line **)
xrealloc (to->vector, to->lines_alloced * sizeof (*to->vector));
}
@@ -7184,6 +7181,8 @@ RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
vers = trunk_vers;
next = vers->next;
linevector_copy (&curlines, &trunklines);
+ linevector_free (&trunklines);
+ linevector_init (&trunklines);
}
}
else