=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.86 retrieving revision 1.87 diff -c -r1.86 -r1.87 *** src/usr.bin/cvs/file.c 2005/06/01 16:49:20 1.86 --- src/usr.bin/cvs/file.c 2005/06/09 01:45:45 1.87 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.86 2005/06/01 16:49:20 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.87 2005/06/09 01:45:45 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 415,425 **** CVSENTRIES *entfile; struct cvs_ent *ent; - entfile = cvs_ent_open(".", O_RDONLY); base = cvs_file_lget(".", 0, NULL, NULL); if (base == NULL) return (NULL); /* * fill in the repository base (needed to construct repo's in * cvs_file_create). --- 415,426 ---- CVSENTRIES *entfile; struct cvs_ent *ent; base = cvs_file_lget(".", 0, NULL, NULL); if (base == NULL) return (NULL); + entfile = cvs_ent_open(".", O_RDONLY); + /* * fill in the repository base (needed to construct repo's in * cvs_file_create). *************** *** 439,444 **** --- 440,447 ---- if (cb != NULL) { if (cb(base, arg) != CVS_EX_OK) { cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); return (NULL); } } *************** *** 464,474 **** --- 467,481 ---- nf = cvs_file_lget(pcopy, 0, base, ent); if (nf == NULL) { cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); return (NULL); } if (cvs_file_attach(base, nf) < 0) { cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); return (NULL); } } *************** *** 480,496 **** --- 487,510 ---- if (cvs_file_getdir(nf, flags, np, cb, arg) < 0) { cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); return (NULL); } } else { if (cb != NULL) { if (cb(nf, arg) != CVS_EX_OK) { cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); return (NULL); } } } } + + if (entfile) + cvs_ent_close(entfile); return (base); }