diff options
-rw-r--r-- | usr.bin/rcs/buf.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/ci.c | 11 | ||||
-rw-r--r-- | usr.bin/rcs/diff3.c | 26 | ||||
-rw-r--r-- | usr.bin/rcs/ident.c | 5 | ||||
-rw-r--r-- | usr.bin/rcs/rcs.c | 14 | ||||
-rw-r--r-- | usr.bin/rcs/rcsclean.c | 8 | ||||
-rw-r--r-- | usr.bin/rcs/rcsdiff.c | 26 | ||||
-rw-r--r-- | usr.bin/rcs/rcsmerge.c | 10 | ||||
-rw-r--r-- | usr.bin/rcs/rcsnum.c | 4 |
9 files changed, 40 insertions, 68 deletions
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c index 7c7931567d9..24d9427862b 100644 --- a/usr.bin/rcs/buf.c +++ b/usr.bin/rcs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.25 2015/06/13 20:15:21 nicm Exp $ */ +/* $OpenBSD: buf.c,v 1.26 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -138,6 +138,8 @@ out: void buf_free(BUF *b) { + if (b == NULL) + return; free(b->cb_buf); free(b); } diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index b31e16e2d9a..0188da9ab37 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.222 2015/09/05 09:38:23 jsg Exp $ */ +/* $OpenBSD: ci.c,v 1.223 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -369,12 +369,9 @@ checkin_diff_file(struct checkin_params *pb) return (b3); out: - if (b1 != NULL) - buf_free(b1); - if (b2 != NULL) - buf_free(b2); - if (b3 != NULL) - buf_free(b3); + buf_free(b1); + buf_free(b2); + buf_free(b3); free(path1); free(path2); diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index ab1964e431e..5e5610c6b4a 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.37 2015/09/05 09:47:08 jsg Exp $ */ +/* $OpenBSD: diff3.c,v 1.38 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -234,14 +234,10 @@ merge_diff3(char **av, int flags) warnx("warning: overlaps or other problems during merge"); out: - if (b2 != NULL) - buf_free(b2); - if (b3 != NULL) - buf_free(b3); - if (d1 != NULL) - buf_free(d1); - if (d2 != NULL) - buf_free(d2); + buf_free(b2); + buf_free(b3); + buf_free(d1); + buf_free(d2); (void)unlink(path1); (void)unlink(path2); @@ -354,14 +350,10 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags) warnx("warning: overlaps or other problems during merge"); out: - if (b2 != NULL) - buf_free(b2); - if (b3 != NULL) - buf_free(b3); - if (d1 != NULL) - buf_free(d1); - if (d2 != NULL) - buf_free(d2); + buf_free(b2); + buf_free(b3); + buf_free(d1); + buf_free(d2); (void)unlink(path1); (void)unlink(path2); diff --git a/usr.bin/rcs/ident.c b/usr.bin/rcs/ident.c index af8f0ac4e18..20bded230fa 100644 --- a/usr.bin/rcs/ident.c +++ b/usr.bin/rcs/ident.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ident.c,v 1.30 2014/10/02 06:23:15 otto Exp $ */ +/* $OpenBSD: ident.c,v 1.31 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -156,8 +156,7 @@ ident_line(FILE *fp) found++; out: - if (bp != NULL) - buf_free(bp); + buf_free(bp); } __dead void diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index 83135cc7390..986dfc90e29 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.83 2015/06/13 20:15:21 nicm Exp $ */ +/* $OpenBSD: rcs.c,v 1.84 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -177,10 +177,8 @@ rcs_close(RCSFILE *rfp) free(rlp); } - if (rfp->rf_head != NULL) - rcsnum_free(rfp->rf_head); - if (rfp->rf_branch != NULL) - rcsnum_free(rfp->rf_branch); + rcsnum_free(rfp->rf_head); + rcsnum_free(rfp->rf_branch); if (rfp->rf_file != NULL) fclose(rfp->rf_file); @@ -1406,10 +1404,8 @@ rcs_freedelta(struct rcs_delta *rdp) { struct rcs_branch *rb; - if (rdp->rd_num != NULL) - rcsnum_free(rdp->rd_num); - if (rdp->rd_next != NULL) - rcsnum_free(rdp->rd_next); + rcsnum_free(rdp->rd_num); + rcsnum_free(rdp->rd_next); free(rdp->rd_author); free(rdp->rd_locker); diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c index 4bff4894fd4..1b60277cf5e 100644 --- a/usr.bin/rcs/rcsclean.c +++ b/usr.bin/rcs/rcsclean.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsclean.c,v 1.54 2015/01/16 06:40:11 deraadt Exp $ */ +/* $OpenBSD: rcsclean.c,v 1.55 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -209,10 +209,8 @@ rcsclean_file(char *fname, const char *rev_str) rcs_set_mtime(file, rcs_mtime); out: - if (b1 != NULL) - buf_free(b1); - if (b2 != NULL) - buf_free(b2); + buf_free(b1); + buf_free(b2); if (file != NULL) rcs_close(file); } diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c index 268070bd8bb..04576caffe1 100644 --- a/usr.bin/rcs/rcsdiff.c +++ b/usr.bin/rcs/rcsdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.83 2015/06/13 20:15:21 nicm Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.84 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -250,15 +250,9 @@ rcsdiff_main(int argc, char **argv) status = rcsdiff_rev(file, rev1, rev2, dflags); rcs_close(file); - - if (rev1 != NULL) { - rcsnum_free(rev1); - rev1 = NULL; - } - if (rev2 != NULL) { - rcsnum_free(rev2); - rev2 = NULL; - } + rcsnum_free(rev1); + rcsnum_free(rev2); + rev1 = rev2 = NULL; } return (status); @@ -354,10 +348,8 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename, int dflags) out: if (fd != -1) (void)close(fd); - if (b1 != NULL) - buf_free(b1); - if (b2 != NULL) - buf_free(b2); + buf_free(b1); + buf_free(b2); free(path1); free(path2); @@ -431,10 +423,8 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2, int dflags) ret = diffreg(path1, path2, NULL, dflags); out: - if (b1 != NULL) - buf_free(b1); - if (b2 != NULL) - buf_free(b2); + buf_free(b1); + buf_free(b2); free(path1); free(path2); diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c index 96ff687d17a..9b810bc03f0 100644 --- a/usr.bin/rcs/rcsmerge.c +++ b/usr.bin/rcs/rcsmerge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsmerge.c,v 1.55 2015/01/16 06:40:11 deraadt Exp $ */ +/* $OpenBSD: rcsmerge.c,v 1.56 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -173,12 +173,8 @@ rcsmerge_main(int argc, char **argv) out: rcs_close(file); - - if (rev1 != NULL) - rcsnum_free(rev1); - if (rev2 != NULL) - rcsnum_free(rev2); - + rcsnum_free(rev1); + rcsnum_free(rev2); return (status); } diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c index 69431dabf53..99c0630a86a 100644 --- a/usr.bin/rcs/rcsnum.c +++ b/usr.bin/rcs/rcsnum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.17 2015/06/13 20:15:21 nicm Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.18 2015/11/02 16:45:21 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -105,6 +105,8 @@ rcsnum_parse(const char *str) void rcsnum_free(RCSNUM *rn) { + if (rn == NULL) + return; free(rn->rn_id); free(rn); } |