summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-09-27 14:36:16 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-09-27 14:36:16 +0000
commit4c3d04352caf5fc943419508d319cb0740cc183d (patch)
treeb4fece0dea3e3c3a83370c189da10df5eccec768 /usr.bin
parent7c6d5e78ab915eb9c9809a18fb4a9c58b891dd3d (diff)
Plug two of the huge leaks that Joris Vink has reported. rcs_freedelta()
didn't free the RCSNUMs associated with the delta version and next one
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 6cbb80996ba..3a7aec08674 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.11 2004/09/25 11:06:50 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.12 2004/09/27 14:36:15 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1377,8 +1377,14 @@ rcs_parse_branches(RCSFILE *rfp, struct rcs_delta *rdp)
void
rcs_freedelta(struct rcs_delta *rdp)
{
+ struct rcs_branch *rb;
struct rcs_delta *crdp;
+ if (rdp->rd_num != NULL)
+ rcsnum_free(rdp->rd_num);
+ if (rdp->rd_next != NULL)
+ rcsnum_free(rdp->rd_next);
+
if (rdp->rd_author != NULL)
free(rdp->rd_author);
if (rdp->rd_state != NULL)
@@ -1388,6 +1394,12 @@ rcs_freedelta(struct rcs_delta *rdp)
if (rdp->rd_text != NULL)
free(rdp->rd_text);
+ while ((rb = TAILQ_FIRST(&(rdp->rd_branches))) != NULL) {
+ TAILQ_REMOVE(&(rdp->rd_branches), rb, rb_list);
+ rcsnum_free(rb->rb_num);
+ free(rb);
+ }
+
while ((crdp = TAILQ_FIRST(&(rdp->rd_snodes))) != NULL) {
TAILQ_REMOVE(&(rdp->rd_snodes), crdp, rd_list);
rcs_freedelta(crdp);