From cc886d2e2051533cd794a9578220d75b44de4487 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Sun, 22 Mar 2009 18:39:11 +0000 Subject: Properly free allocated memory in error case. ok joris --- usr.bin/cvs/rcs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'usr.bin/cvs/rcs.c') 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 * 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); -- cgit v1.2.3