cvsdist 1f06ef5
--- rdist-6.1.5/src/client.c.links	Wed Feb 17 17:46:09 1999
cvsdist 1f06ef5
+++ rdist-6.1.5/src/client.c	Wed Feb 17 17:51:15 1999
cvsdist 1f06ef5
@@ -309,6 +309,18 @@
cvsdist 1f06ef5
 	return(0);
cvsdist 1f06ef5
 }
cvsdist 1f06ef5
 
cvsdist 1f06ef5
+void freelinkinfo(lp)
cvsdist 1f06ef5
+	struct linkbuf *lp;
cvsdist 1f06ef5
+{
cvsdist 1f06ef5
+	if (lp->pathname)
cvsdist 1f06ef5
+		free(lp->pathname);
cvsdist 1f06ef5
+	if (lp->src)
cvsdist 1f06ef5
+		free(lp->src);
cvsdist 1f06ef5
+	if (lp->target)
cvsdist 1f06ef5
+		free(lp->target);
cvsdist 1f06ef5
+	free(lp);
cvsdist 1f06ef5
+}
cvsdist 1f06ef5
+
cvsdist 1f06ef5
 /*
cvsdist 1f06ef5
  * Save and retrieve hard link info
cvsdist 1f06ef5
  */
cvsdist 1f06ef5
@@ -317,6 +329,7 @@
cvsdist 1f06ef5
 {
cvsdist 1f06ef5
 	struct linkbuf *lp;
cvsdist 1f06ef5
 
cvsdist 1f06ef5
+	/* xxx: linear search doesn't scale with many links */
cvsdist 1f06ef5
 	for (lp = ihead; lp != NULL; lp = lp->nextp)
cvsdist 1f06ef5
 		if (lp->inum == statp->st_ino && lp->devnum == statp->st_dev) {
cvsdist 1f06ef5
 			lp->count--;
cvsdist 1f06ef5
@@ -329,12 +342,14 @@
cvsdist 1f06ef5
 	lp->inum = statp->st_ino;
cvsdist 1f06ef5
 	lp->devnum = statp->st_dev;
cvsdist 1f06ef5
 	lp->count = statp->st_nlink - 1;
cvsdist 1f06ef5
-	(void) strcpy(lp->pathname, target);
cvsdist 1f06ef5
-	(void) strcpy(lp->src, source);
cvsdist 1f06ef5
+	lp->pathname = strdup(target);
cvsdist 1f06ef5
+	lp->src = strdup(source);
cvsdist 1f06ef5
 	if (Tdest)
cvsdist 1f06ef5
-		(void) strcpy(lp->target, Tdest);
cvsdist 1f06ef5
+		lp->target = strdup(Tdest);
cvsdist 1f06ef5
 	else
cvsdist 1f06ef5
-		*lp->target = CNULL;
cvsdist 1f06ef5
+		lp->target = NULL;
cvsdist 1f06ef5
+	if (!lp->pathname || !lp->src || !(Tdest && lp->target))
cvsdist 1f06ef5
+		fatalerr("Cannot malloc memory in linkinfo.");
cvsdist 1f06ef5
 
cvsdist 1f06ef5
 	return((struct linkbuf *) NULL);
cvsdist 1f06ef5
 }
cvsdist 1f06ef5
--- rdist-6.1.5/src/docmd.c.links	Wed Feb 17 17:51:23 1999
cvsdist 1f06ef5
+++ rdist-6.1.5/src/docmd.c	Wed Feb 17 17:52:44 1999
cvsdist 1f06ef5
@@ -586,7 +586,7 @@
cvsdist 1f06ef5
 	if (!nflag) {
cvsdist 1f06ef5
 		register struct linkbuf *nextl, *l;
cvsdist 1f06ef5
 
cvsdist 1f06ef5
-		for (l = ihead; l != NULL; free((char *)l), l = nextl) {
cvsdist 1f06ef5
+		for (l = ihead; l != NULL; freelinkinfo(l), l = nextl) {
cvsdist 1f06ef5
 			nextl = l->nextp;
cvsdist 1f06ef5
 			if (contimedout || IS_ON(opts, DO_IGNLNKS) || 
cvsdist 1f06ef5
 			    l->count == 0)
cvsdist 1f06ef5
--- rdist-6.1.5/include/defs.h.links	Wed Feb 17 17:52:58 1999
cvsdist 1f06ef5
+++ rdist-6.1.5/include/defs.h	Wed Feb 17 17:53:47 1999
cvsdist 1f06ef5
@@ -276,9 +276,9 @@
cvsdist 1f06ef5
 	ino_t	inum;
cvsdist 1f06ef5
 	dev_t	devnum;
cvsdist 1f06ef5
 	int	count;
cvsdist 1f06ef5
-	char	pathname[BUFSIZ];
cvsdist 1f06ef5
-	char	src[BUFSIZ];
cvsdist 1f06ef5
-	char	target[BUFSIZ];
cvsdist 1f06ef5
+	char	*pathname;
cvsdist 1f06ef5
+	char	*src;
cvsdist 1f06ef5
+	char	*target;
cvsdist 1f06ef5
 	struct	linkbuf *nextp;
cvsdist 1f06ef5
 };
cvsdist 1f06ef5