=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/server.c,v retrieving revision 1.50 retrieving revision 1.51 diff -c -r1.50 -r1.51 *** src/usr.bin/cvs/server.c 2007/01/18 16:45:52 1.50 --- src/usr.bin/cvs/server.c 2007/01/25 18:56:33 1.51 *************** *** 1,4 **** ! /* $OpenBSD: server.c,v 1.50 2007/01/18 16:45:52 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * --- 1,4 ---- ! /* $OpenBSD: server.c,v 1.51 2007/01/25 18:56:33 otto Exp $ */ /* * Copyright (c) 2006 Joris Vink * *************** *** 220,261 **** cvs_server_static_directory(char *data) { FILE *fp; ! char *fpath; - fpath = xmalloc(MAXPATHLEN); if (cvs_path_cat(server_currentdir, CVS_PATH_STATICENTRIES, fpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_static_directory: truncation"); if ((fp = fopen(fpath, "w+")) == NULL) { cvs_log(LP_ERRNO, "%s", fpath); ! goto out; } (void)fclose(fp); - out: - xfree(fpath); } void cvs_server_sticky(char *data) { FILE *fp; ! char *tagpath; - tagpath = xmalloc(MAXPATHLEN); if (cvs_path_cat(server_currentdir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_sticky: truncation"); if ((fp = fopen(tagpath, "w+")) == NULL) { cvs_log(LP_ERRNO, "%s", tagpath); ! goto out; } (void)fprintf(fp, "%s\n", data); (void)fclose(fp); - out: - xfree(tagpath); } void --- 220,255 ---- cvs_server_static_directory(char *data) { FILE *fp; ! char fpath[MAXPATHLEN]; if (cvs_path_cat(server_currentdir, CVS_PATH_STATICENTRIES, fpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_static_directory: truncation"); if ((fp = fopen(fpath, "w+")) == NULL) { cvs_log(LP_ERRNO, "%s", fpath); ! return; } (void)fclose(fp); } void cvs_server_sticky(char *data) { FILE *fp; ! char tagpath[MAXPATHLEN]; if (cvs_path_cat(server_currentdir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_sticky: truncation"); if ((fp = fopen(tagpath, "w+")) == NULL) { cvs_log(LP_ERRNO, "%s", tagpath); ! return; } (void)fprintf(fp, "%s\n", data); (void)fclose(fp); } void *************** *** 299,305 **** { int l; CVSENTRIES *entlist; ! char *dir, *repo, *parent, *entry, *dirn, *p; dir = cvs_remote_input(); STRIP_SLASH(dir); --- 293,299 ---- { int l; CVSENTRIES *entlist; ! char *dir, *repo, *parent, entry[CVS_ENT_MAXLINELEN], *dirn, *p; dir = cvs_remote_input(); STRIP_SLASH(dir); *************** *** 331,344 **** if (strcmp(parent, ".")) { entlist = cvs_ent_open(parent); - entry = xmalloc(CVS_ENT_MAXLINELEN); l = snprintf(entry, CVS_ENT_MAXLINELEN, "D/%s////", dirn); if (l == -1 || l >= CVS_ENT_MAXLINELEN) fatal("cvs_server_directory: overflow"); cvs_ent_add(entlist, entry); cvs_ent_close(entlist, ENT_SYNC); - xfree(entry); } if (server_currentdir != NULL) --- 325,336 ---- *************** *** 366,372 **** size_t flen; mode_t fmode; const char *errstr; ! char *mode, *len, *fpath; mode = cvs_remote_input(); len = cvs_remote_input(); --- 358,364 ---- size_t flen; mode_t fmode; const char *errstr; ! char *mode, *len, fpath[MAXPATHLEN]; mode = cvs_remote_input(); len = cvs_remote_input(); *************** *** 379,385 **** fatal("cvs_server_modified: %s", errstr); xfree(len); - fpath = xmalloc(MAXPATHLEN); if (cvs_path_cat(server_currentdir, data, fpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_modified: truncation"); --- 371,376 ---- *************** *** 392,398 **** if (fchmod(fd, 0600) == -1) fatal("cvs_server_modified: failed to set file mode"); - xfree(fpath); (void)close(fd); } --- 383,388 ---- *************** *** 405,416 **** cvs_server_unchanged(char *data) { int fd; ! char *fpath; CVSENTRIES *entlist; struct cvs_ent *ent; struct timeval tv[2]; - fpath = xmalloc(MAXPATHLEN); if (cvs_path_cat(server_currentdir, data, fpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_unchanged: truncation"); --- 395,405 ---- cvs_server_unchanged(char *data) { int fd; ! char fpath[MAXPATHLEN]; CVSENTRIES *entlist; struct cvs_ent *ent; struct timeval tv[2]; if (cvs_path_cat(server_currentdir, data, fpath, MAXPATHLEN) >= MAXPATHLEN) fatal("cvs_server_unchanged: truncation"); *************** *** 434,440 **** fatal("cvs_server_unchanged: failed to set mode"); cvs_ent_free(ent); - xfree(fpath); (void)close(fd); } --- 423,428 ---- *************** *** 624,635 **** cvs_server_update_entry(const char *resp, struct cvs_file *cf) { int l; ! char *p, *response; if ((p = strrchr(cf->file_rpath, ',')) != NULL) *p = '\0'; - response = xmalloc(MAXPATHLEN); l = snprintf(response, MAXPATHLEN, "%s %s/", resp, cf->file_wd); if (l == -1 || l >= MAXPATHLEN) fatal("cvs_server_update_entry: overflow"); --- 612,622 ---- cvs_server_update_entry(const char *resp, struct cvs_file *cf) { int l; ! char *p, response[MAXPATHLEN]; if ((p = strrchr(cf->file_rpath, ',')) != NULL) *p = '\0'; l = snprintf(response, MAXPATHLEN, "%s %s/", resp, cf->file_wd); if (l == -1 || l >= MAXPATHLEN) fatal("cvs_server_update_entry: overflow"); *************** *** 639,644 **** if (p != NULL) *p = ','; - - xfree(response); } --- 626,629 ----