summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/add.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-01-12 19:28:13 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-01-12 19:28:13 +0000
commit2a0a7d337321a12b7989aaf375e262b416ac99dc (patch)
treed7d862bc2672f2e46c71f0ea9822790ea5a73cd7 /usr.bin/cvs/add.c
parent0d4487fe419f565308ab5595eebcf02edc704636 (diff)
do not leak memory from rcs_head_get()
ok niallo@
Diffstat (limited to 'usr.bin/cvs/add.c')
-rw-r--r--usr.bin/cvs/add.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index e4e8134dbb4..cb9abda8a39 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.67 2007/01/12 03:34:50 joris Exp $ */
+/* $OpenBSD: add.c,v 1.68 2007/01/12 19:28:12 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -251,9 +251,11 @@ add_file(struct cvs_file *cf)
char revbuf[16];
RCSNUM *head;
- if (cf->file_rcs != NULL)
- rcsnum_tostr(rcs_head_get(cf->file_rcs),
- revbuf, sizeof(revbuf));
+ if (cf->file_rcs != NULL) {
+ head = rcs_head_get(cf->file_rcs);
+ rcsnum_tostr(head, revbuf, sizeof(revbuf));
+ rcsnum_free(head);
+ }
added = stop = 0;
switch (cf->file_status) {
@@ -273,6 +275,8 @@ add_file(struct cvs_file *cf)
/* Restore the file. */
head = rcs_head_get(cf->file_rcs);
b = rcs_getrev(cf->file_rcs, head);
+ rcsnum_free(head);
+
if (b == NULL)
fatal("cvs_add_local: failed to get HEAD");