diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2009-03-22 18:39:11 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2009-03-22 18:39:11 +0000 |
commit | cc886d2e2051533cd794a9578220d75b44de4487 (patch) | |
tree | 3eb1f21a9d540f557dc5fdb4797ee9ca5da32f31 /usr.bin/cvs/rcs.c | |
parent | 5f7afbc230ce61b3bb30a2b204722c73e52050b4 (diff) |
Properly free allocated memory in error case.
ok joris
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r-- | usr.bin/cvs/rcs.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 38c3a817217..42dd1bfa2bc 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.286 2009/02/21 19:46:40 tobias Exp $ */ +/* $OpenBSD: rcs.c,v 1.287 2009/03/22 18:39:10 tobias Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -614,12 +614,14 @@ rcs_branch_new(RCSFILE *file, RCSNUM *rev) if (!rcsnum_cmp(sym->rs_num, brev, 0)) break; - if (sym != NULL) { - if (rcsnum_inc(brev) == NULL || - rcsnum_inc(brev) == NULL) - return (NULL); - } else + if (sym == NULL) break; + + if (rcsnum_inc(brev) == NULL || + rcsnum_inc(brev) == NULL) { + rcsnum_free(brev); + return (NULL); + } } return (brev); |