summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2004-08-31 11:17:03 +0000
committerJoris Vink <joris@cvs.openbsd.org>2004-08-31 11:17:03 +0000
commitf1939467b4d7de57e492f81dc1c6e554ed8aa2ce (patch)
treedc00aa98c1cb8d51d039f2c130edec15f7b4dc8f
parent71b9865309c87677dc74c03bc00afe12c4823493 (diff)
check return value of strdup(3);
ok jfb
-rw-r--r--usr.bin/cvs/file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 916bc423ab6..dce9e4b2811 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.32 2004/08/27 15:43:15 jfb Exp $ */
+/* $OpenBSD: file.c,v 1.33 2004/08/31 11:17:02 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -247,6 +247,11 @@ cvs_file_create(const char *path, u_int type, mode_t mode)
cfp->cf_ddat->cd_root = cvsroot_get(path);
cfp->cf_ddat->cd_repo = strdup(cfp->cf_path);
+ if (cfp->cf_ddat->cd_repo == NULL) {
+ cvs_file_free(cfp);
+ return (NULL);
+ }
+
if (type == DT_DIR) {
if ((mkdir(path, mode) == -1) || (cvs_mkadmin(cfp, mode) < 0)) {
cvs_file_free(cfp);