diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-04-06 03:27:55 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-04-06 03:27:55 +0000 |
commit | 93d6232502a892a81275c590a3901b3791288078 (patch) | |
tree | d9a98b71e8cc56029dafa32deb5d3518c2a5855c /usr.bin | |
parent | 95c738054abbcc6ce4caaf1934b1143a9bd79bac (diff) |
make sure we don't try and return csp->cs_str when
cvs_strtab_insert() fails.
ok jfb@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/strtab.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/cvs/strtab.c b/usr.bin/cvs/strtab.c index ca39ffae7d7..810162f72db 100644 --- a/usr.bin/cvs/strtab.c +++ b/usr.bin/cvs/strtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtab.c,v 1.3 2005/03/29 15:04:45 joris Exp $ */ +/* $OpenBSD: strtab.c,v 1.4 2005/04/06 03:27:54 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -75,10 +75,12 @@ cvs_strdup(const char *s) { struct cvs_str *csp; - if ((csp = cvs_strtab_lookup(s)) == NULL) - csp = cvs_strtab_insert(s); - else + if ((csp = cvs_strtab_lookup(s)) == NULL) { + if ((csp = cvs_strtab_insert(s)) == NULL) + return (NULL); + } else { csp->cs_ref++; + } return (csp->cs_str); } |