summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/co.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-12-10 20:27:47 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-12-10 20:27:47 +0000
commit9eb5d4f85893529cdca5a54796e344ecb6581196 (patch)
treef6078dc6aa0b2687219c6431ba7f872b4326c298 /usr.bin/rcs/co.c
parentcc2c3fa0314517ddf972b8ca44e9d25aee920bc1 (diff)
switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him. next step is to use fatal() through out the code for unrecoverable errors instead of trying to be all nice and fluffy and reach main() again. ok niallo@ and xsa@
Diffstat (limited to 'usr.bin/rcs/co.c')
-rw-r--r--usr.bin/rcs/co.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index ed3ea8b4465..76b7373b312 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.46 2005/12/09 06:59:27 joris Exp $ */
+/* $OpenBSD: co.c,v 1.47 2005/12/10 20:27:46 joris Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -94,10 +94,7 @@ checkout_main(int argc, char **argv)
rcs_set_rev(rcs_optarg, &rev);
break;
case 's':
- if ((state = strdup(rcs_optarg)) == NULL) {
- cvs_log(LP_ERRNO, "out of memory");
- exit(1);
- }
+ state = xstrdup(rcs_optarg);
flags |= CO_STATE;
break;
case 'T':
@@ -118,11 +115,8 @@ checkout_main(int argc, char **argv)
"could not get login");
exit(1);
}
- } else if ((author = strdup(rcs_optarg)) == NULL) {
- cvs_log(LP_ERRNO, "out of memory");
- exit(1);
- }
-
+ } else
+ author = xstrdup(rcs_optarg);
flags |= CO_AUTHOR;
break;
case 'x':
@@ -350,7 +344,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
cvs_buf_putc(bp, '\0');
content = cvs_buf_release(bp);
printf("%s", content);
- free(content);
+ xfree(content);
} else {
if (cvs_buf_write(bp, dst, mode) < 0) {
cvs_log(LP_ERR, "failed to write revision to file");