diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-12-21 15:37:45 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-12-21 15:37:45 +0000 |
commit | 5408056619abaa262d44882d61df1259095f54f1 (patch) | |
tree | 5e002a82d2e14fcb7eb40657978b3eb3ac5e292f /usr.bin/rcs/rcs.c | |
parent | 29e867868b244a1a018e17c7ec4c9f3b72a4a7fc (diff) |
- plug memleak in rcs_parse_delta()
same as opencvs diff, ok xsa@
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r-- | usr.bin/rcs/rcs.c | 17 |
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; |