summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/resp.c
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-06 18:40:34 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-01-06 18:40:34 +0000
commitf0ea43d624841f98a2ae641a79983c9e057e0593 (patch)
treeb5b2bf535267c1519dae67846b425e3148774aa7 /usr.bin/cvs/resp.c
parent453dabba2477699dd8666c61b8ca52aab6a84b72 (diff)
check the return value of a strdup() call and return an error on
failure from Joris Vink
Diffstat (limited to 'usr.bin/cvs/resp.c')
-rw-r--r--usr.bin/cvs/resp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c
index 028ad22b3a8..238e876a625 100644
--- a/usr.bin/cvs/resp.c
+++ b/usr.bin/cvs/resp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resp.c,v 1.18 2004/12/13 22:53:48 jfb Exp $ */
+/* $OpenBSD: resp.c,v 1.19 2005/01/06 18:40:33 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -385,6 +385,11 @@ cvs_resp_sticky(struct cvsroot *root, int type, char *line)
if (cf == NULL)
return (-1);
cf->cf_ddat->cd_repo = strdup(line);
+ if (cf->cf_ddat->cd_repo == NULL) {
+ cvs_log(LP_ERRNO, "failed to duplicate `%s'", line);
+ cvs_file_free(cf);
+ return (-1);
+ }
cf->cf_ddat->cd_root = root;
root->cr_ref++;