diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-03-02 03:05:03 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-03-02 03:05:03 +0000 |
commit | 5f119ab47b093c9775f042875dfc844aa9961dab (patch) | |
tree | d95181e92dfeb6c618a255fb7219da6928539d5a /usr.bin/cvs | |
parent | e64db64ae224c0118e067a933cf426e30031fcf0 (diff) |
- make sure we are using a remote method before calling
cvs_sendreq() and cvs_sendfile().
- don't leak entp on errors.
ok jfb@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/commit.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index 769d14fb14e..821d9680a67 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.15 2005/02/22 23:34:28 jfb Exp $ */ +/* $OpenBSD: commit.c,v 1.16 2005/03/02 03:05:02 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -213,16 +213,23 @@ cvs_commit_file(CVSFILE *cf, void *arg) if ((cf->cf_cvstat == CVS_FST_ADDED) || (cf->cf_cvstat == CVS_FST_MODIFIED)) { - if ((root->cr_method != CVS_METHOD_LOCAL) && - (cvs_sendentry(root, entp) < 0)) { - cvs_ent_free(entp); - return (-1); - } + if (root->cr_method != CVS_METHOD_LOCAL) { + if (cvs_sendentry(root, entp) < 0) { + cvs_ent_free(entp); + return (-1); + } - if ((cvs_sendreq(root, CVS_REQ_MODIFIED, - CVS_FILE_NAME(cf)) < 0) || - (cvs_sendfile(root, fpath) < 0)) - return (-1); + if (cvs_sendreq(root, CVS_REQ_MODIFIED, + CVS_FILE_NAME(cf)) < 0) { + cvs_ent_free(entp); + return (-1); + } + + if (cvs_sendfile(root, fpath) < 0) { + cvs_ent_free(entp); + return (-1); + } + } } snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", |