summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2006-12-21 15:03:16 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2006-12-21 15:03:16 +0000
commit2ecfb0181f97bb43fa4a3e45c751b2f50e2d2e18 (patch)
treebb6ec39d0708a9db8d96a96f308dd6c14914ef19 /usr.bin
parenta593c17f14c4342059f48a2bb5c16334c560a2c2 (diff)
- plug memory leak in rcs_parse_delta()
ok joris@ ray@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index a834daf4238..65a4a812c50 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.191 2006/12/21 14:59:25 niallo Exp $ */
+/* $OpenBSD: rcs.c,v 1.192 2006/12/21 15:03:15 niallo Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1874,13 +1874,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);
@@ -1889,9 +1882,16 @@ rcs_parse_delta(RCSFILE *rfp)
rcs_errno = RCS_ERR_PARSE;
cvs_log(LP_ERR, "unexpected token `%s' at start of delta",
RCS_TOKSTR(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;