summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2006-12-21 15:37:45 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2006-12-21 15:37:45 +0000
commit5408056619abaa262d44882d61df1259095f54f1 (patch)
tree5e002a82d2e14fcb7eb40657978b3eb3ac5e292f
parent29e867868b244a1a018e17c7ec4c9f3b72a4a7fc (diff)
- plug memleak in rcs_parse_delta()
same as opencvs diff, ok xsa@
-rw-r--r--usr.bin/rcs/rcs.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 7cd00bb0ce2..eebd59abbfa 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.33 2006/09/21 15:30:07 millert Exp $ */
+/* $OpenBSD: rcs.c,v 1.34 2006/12/21 15:37:44 niallo Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1866,13 +1866,6 @@ rcs_parse_delta(RCSFILE *rfp)
struct rcs_delta *rdp;
struct rcs_key *rk;
- rdp = xcalloc(1, sizeof(*rdp));
-
- rdp->rd_num = rcsnum_alloc();
- rdp->rd_next = rcsnum_alloc();
-
- TAILQ_INIT(&(rdp->rd_branches));
-
tok = rcs_gettok(rfp);
if (tok == RCS_TOK_DESC) {
rcs_pushtok(rfp, RCS_TOKSTR(rfp), tok);
@@ -1884,6 +1877,14 @@ rcs_parse_delta(RCSFILE *rfp)
rcs_freedelta(rdp);
return (-1);
}
+
+ rdp = xcalloc(1, sizeof(*rdp));
+
+ rdp->rd_num = rcsnum_alloc();
+ rdp->rd_next = rcsnum_alloc();
+
+ TAILQ_INIT(&(rdp->rd_branches));
+
rcsnum_aton(RCS_TOKSTR(rfp), NULL, rdp->rd_num);
hmask = 0;