=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/cvs/file.c 2004/08/13 13:28:53 1.29 --- src/usr.bin/cvs/file.c 2004/08/27 13:05:55 1.30 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.29 2004/08/13 13:28:53 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.30 2004/08/27 13:05:55 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 254,260 **** } cfp->cf_ddat->cd_ent = cvs_ent_open(path, O_RDWR); - } else { fd = open(path, O_WRONLY|O_CREAT|O_EXCL, mode); --- 254,259 ---- *************** *** 428,433 **** --- 427,434 ---- * cvs_file_getdir() * * Get a cvs directory structure for the directory whose path is . + * This function should not free the directory information on error, as this + * is performed by cvs_file_free(). */ static int *************** *** 450,459 **** if (cf->cf_cvstat != CVS_FST_UNKNOWN) { cdp->cd_root = cvsroot_get(cf->cf_path); ! if (cdp->cd_root == NULL) { ! cvs_file_freedir(cdp); return (-1); - } if (flags & CF_MKADMIN) cvs_mkadmin(cf, 0755); --- 451,458 ---- if (cf->cf_cvstat != CVS_FST_UNKNOWN) { cdp->cd_root = cvsroot_get(cf->cf_path); ! if (cdp->cd_root == NULL) return (-1); if (flags & CF_MKADMIN) cvs_mkadmin(cf, 0755); *************** *** 468,474 **** if (cdp->cd_repo == NULL) { cvs_log(LP_ERRNO, "failed to dup repository string"); - free(cdp); return (-1); } } --- 467,472 ---- *************** *** 483,489 **** fd = open(cf->cf_path, O_RDONLY); if (fd == -1) { cvs_log(LP_ERRNO, "failed to open `%s'", cf->cf_path); - cvs_file_freedir(cdp); return (-1); } --- 481,486 ---- *************** *** 492,498 **** if (ret == -1) { cvs_log(LP_ERRNO, "failed to get directory entries"); (void)close(fd); - cvs_file_freedir(cdp); return (-1); } --- 489,494 ----