summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-08 19:54:12 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-08 19:54:12 +0000
commit798a48ded0c60f155bc123fa7483a0b254d8bb62 (patch)
tree8a723826d02903a572e206819b56067ccc3ee486 /usr.bin
parent45729f0bf83a628d55387b93f9102cf2c63b8058 (diff)
check the return value of a strdup() call and return an error on
failure from Joris Vink
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 1c1d7dd9445..670f5c20d95 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.41 2004/12/08 19:44:28 jfb Exp $ */
+/* $OpenBSD: file.c,v 1.42 2004/12/08 19:54:11 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -946,6 +946,12 @@ cvs_file_getname(const char *name)
}
fnp->cf_name = strdup(name);
+ if (fnp->cf_name == NULL) {
+ cvs_log(LP_ERRNO, "failed to duplicate name");
+ free(fnp);
+ return (NULL);
+ }
+
fnp->cf_ref = 1;
SLIST_INSERT_HEAD(&(cvs_fnht[h]), fnp, cf_list);
}