Hi,

The diff below adds a patch by uwe@, taken from his git-cvs repo.

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/py-rcsparse/Makefile,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 Makefile
--- Makefile    11 Mar 2013 10:50:26 -0000      1.11
+++ Makefile    15 May 2013 13:54:23 -0000
@@ -8,6 +8,7 @@ VERSION=                20090807
 DISTNAME=              ${CHANGESET}
 EXTRACT_SUFX=          .tar.bz2
 PKGNAME=               rcsparse-${VERSION}
+REVISION=              0
 CATEGORIES=            devel
 
 PERMIT_PACKAGE_CDROM=  Yes
Index: patches/patch-rcsparse_c
===================================================================
RCS file: patches/patch-rcsparse_c
diff -N patches/patch-rcsparse_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-rcsparse_c    15 May 2013 13:54:23 -0000
@@ -0,0 +1,61 @@
+$OpenBSD$
+
+Free the fulltext of unmatched revisions while searching for the
+requested revision to avoid exhausting all available memory during
+the search.
+
+--- rcsparse.c.orig    Fri Aug  7 00:21:50 2009
++++ rcsparse.c Wed May 15 15:22:45 2013
+@@ -937,7 +937,7 @@ rcscheckout(struct rcsfile *rcs, const char *revstr, s
+ {
+       struct rcsrev searchrev;
+       struct rcstoken searchtok;
+-      struct rcsrev *currcsrev;
++      struct rcsrev *currcsrev, *curtextrev;
+       struct stringinfo *curtext;
+       struct rcstoken *nextrev;
+       char *branchrev, *tmpstr;
+@@ -946,6 +946,7 @@ rcscheckout(struct rcsfile *rcs, const char *revstr, s
+       if (rcsparsetree(rcs) < 0)
+               return NULL;
+ 
++      curtextrev = NULL;
+       curtext = NULL;
+       nextrev = NULL;
+       branchrev = NULL;
+@@ -986,6 +987,7 @@ rcscheckout(struct rcsfile *rcs, const char *revstr, s
+ 
+               if (curtext == NULL) {
+                       curtext = currcsrev->rawtext;
++                      curtextrev = currcsrev;
+               } else {
+                       if (nextrev == NULL)
+                               goto fail;
+@@ -995,7 +997,12 @@ rcscheckout(struct rcsfile *rcs, const char *revstr, s
+ 
+                       if (currcsrev->text) {
+                               /* Was expanded before */
++                              if (curtextrev != NULL) {
++                                      free(curtextrev->text);
++                                      curtextrev->text = NULL;
++                              }
+                               curtext = currcsrev->text;
++                              curtextrev = currcsrev;
+                       } else {
+                               if (currcsrev->rawtext == NULL)
+                                       goto fail;
+@@ -1004,9 +1011,12 @@ rcscheckout(struct rcsfile *rcs, const char *revstr, s
+                                       goto fail;
+                               if (applydelta(&currcsrev->text, 
currcsrev->rawtext) < 0)
+                                       goto fail;
+-                              free(currcsrev->rawtext);
+-                              currcsrev->rawtext = NULL;
++                              if (curtextrev != NULL) {
++                                      free(curtextrev->text);
++                                      curtextrev->text = NULL;
++                              }
+                               curtext = currcsrev->text;
++                              curtextrev = currcsrev;
+                       }
+               }
+ 

Reply via email to