diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-05-29 21:17:45 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-05-29 21:17:45 +0000 |
commit | c521d6bd3158ca67c1f55cf4594caac9cff0caa0 (patch) | |
tree | 01b0ef9ab3f0c2c7bc99b658e585c6c452e0e236 | |
parent | cee4b29fca364eadc8171b9da31573acf0b879c7 (diff) |
Plug more memory leaks.
OK joris@
-rw-r--r-- | usr.bin/rcs/ci.c | 12 | ||||
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 7 |
2 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 9705296be35..df948b94b1d 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.176 2006/05/29 02:58:16 niallo Exp $ */ +/* $OpenBSD: ci.c,v 1.177 2006/05/29 21:17:44 ray Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -63,8 +63,9 @@ struct checkin_params { time_t date; RCSFILE *file; RCSNUM *frev, *newrev; + const char *description, *symbol; char fpath[MAXPATHLEN], *rcs_msg, *username, *deltatext, *filename; - char *author, *description, *state, *symbol; + char *author, *state; }; static int checkin_attach_symbol(struct checkin_params *); @@ -108,7 +109,8 @@ checkin_main(int argc, char **argv) pb.date = DATE_NOW; pb.file = NULL; pb.rcs_msg = pb.username = pb.author = pb.state = NULL; - pb.symbol = pb.description = pb.deltatext = NULL; + pb.description = pb.symbol = NULL; + pb.deltatext = NULL; pb.newrev = NULL; pb.flags = status = 0; pb.fmode = S_IRUSR|S_IRGRP|S_IROTH; @@ -164,9 +166,7 @@ checkin_main(int argc, char **argv) pb.flags |= CI_SYMFORCE; /* FALLTHROUGH */ case 'n': - if (pb.symbol != NULL) - xfree(pb.symbol); - pb.symbol = xstrdup(rcs_optarg); + pb.symbol = rcs_optarg; if (rcs_sym_check(pb.symbol) != 1) errx(1, "invalid symbol `%s'", pb.symbol); break; diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index 1d7bb00c2d7..dcb72fe07e6 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.130 2006/05/28 23:16:31 ray Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.131 2006/05/29 21:17:44 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -238,6 +238,8 @@ rcs_main(int argc, char **argv) rcsflags |= RCSPROG_LFLAG; break; case 'm': + if (logstr != NULL) + xfree(logstr); logstr = xstrdup(rcs_optarg); break; case 'M': @@ -503,9 +505,6 @@ rcs_main(int argc, char **argv) (void)fprintf(stderr, "done\n"); } - if (logstr != NULL) - xfree(logstr); - return (0); } |