diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-01-24 20:43:13 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2005-01-24 20:43:13 +0000 |
commit | 048d1189465934d81e3fb1269fdb9e82c730b3df (patch) | |
tree | 49da8a4e4ed277ae9eee7983fc06282052cd84b7 /usr.bin/cvs/rcs.c | |
parent | c81543684b7825c625fdbcef99aa51925afa9bc0 (diff) |
more error checking
looks ok from Joris Vink
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r-- | usr.bin/cvs/rcs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 873e41332ea..3c6c4fb96e6 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.22 2005/01/14 00:47:44 jfb Exp $ */ +/* $OpenBSD: rcs.c,v 1.23 2005/01/24 20:43:12 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -619,8 +619,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev) /* Apply patches backwards to get the right version. * This will need some rework to support sub branches. */ - crev = rcsnum_alloc(); - if (crev == NULL) { + if ((crev = rcsnum_alloc()) == NULL) { cvs_buf_free(rbuf); return (NULL); } @@ -634,7 +633,11 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev) return (NULL); } - cvs_buf_putc(rbuf, '\0'); + if (cvs_buf_putc(rbuf, '\0') < 0) { + rcsnum_free(crev); + cvs_buf_free(rbuf); + return (NULL); + } bp = cvs_buf_release(rbuf); rbuf = rcs_patch((char *)bp, rdp->rd_text); if (rbuf == NULL) |