Applied, thanks. I don't know why cvs and rcs xmalloc.c has ended up so different.
On Thu, Nov 05, 2015 at 11:50:51AM +0800, Michael W. Bombardieri wrote: > Hi tech@, > > Function xfree() was previously removed from rcs, so drop it from > opencvs too... > > http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/rcs/xmalloc.c?f=h#rev1.9 > > Footnote: > I noticed that rcsnum_free() is just free() so maybe that could be > removed also (not included in this patch). > > - Michael > > > Index: add.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/add.c,v > retrieving revision 1.111 > diff -u -p -u -r1.111 add.c > --- add.c 16 Jan 2015 06:40:06 -0000 1.111 > +++ add.c 5 Nov 2015 02:49:20 -0000 > @@ -20,6 +20,7 @@ > > #include <errno.h> > #include <fcntl.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -146,7 +147,7 @@ cvs_add_entry(struct cvs_file *cf) > entlist = cvs_ent_open(cf->file_wd); > cvs_ent_add(entlist, entry); > > - xfree(entry); > + free(entry); > } else { > add_entry(cf); > } > @@ -252,7 +253,7 @@ cvs_add_tobranch(struct cvs_file *cf, ch > (void)xsnprintf(attic, PATH_MAX, "%s/%s/%s%s", repo, > CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT); > > - xfree(cf->file_rpath); > + free(cf->file_rpath); > cf->file_rpath = xstrdup(attic); > > cf->repo_fd = open(cf->file_rpath, O_CREAT|O_RDONLY); > @@ -277,7 +278,7 @@ cvs_add_tobranch(struct cvs_file *cf, ch > if (rcs_rev_add(cf->file_rcs, RCS_HEAD_REV, msg, -1, NULL) == -1) > fatal("cvs_add_tobranch: failed to create first branch " > "revision"); > - xfree(msg); > + free(msg); > > if (rcs_findrev(cf->file_rcs, cf->file_rcs->rf_head) == NULL) > fatal("cvs_add_tobranch: cannot find newly added revision"); > @@ -359,7 +360,7 @@ add_directory(struct cvs_file *cf) > > entlist = cvs_ent_open(cf->file_wd); > cvs_ent_add(entlist, p); > - xfree(p); > + free(p); > } > } > > @@ -381,10 +382,8 @@ add_directory(struct cvs_file *cf) > } > cvs_printf("%s\n", msg); > > - if (tag != NULL) > - xfree(tag); > - if (date != NULL) > - xfree(date); > + free(tag); > + free(date); > > cvs_get_repository_name(cf->file_path, repo, PATH_MAX); > line_list = cvs_trigger_getlines(CVS_PATH_LOGINFO, repo); > @@ -400,8 +399,7 @@ add_directory(struct cvs_file *cf) > > cvs_trigger_freeinfo(&files_info); > cvs_trigger_freelist(line_list); > - if (loginfo != NULL) > - xfree(loginfo); > + free(loginfo); > } > } > > @@ -564,5 +562,5 @@ add_entry(struct cvs_file *cf) > entlist = cvs_ent_open(cf->file_wd); > cvs_ent_add(entlist, entry); > } > - xfree(entry); > + free(entry); > } > Index: admin.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/admin.c,v > retrieving revision 1.65 > diff -u -p -u -r1.65 admin.c > --- admin.c 16 Jan 2015 06:40:06 -0000 1.65 > +++ admin.c 5 Nov 2015 02:49:20 -0000 > @@ -23,6 +23,7 @@ > #include <errno.h> > #include <fcntl.h> > #include <libgen.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -304,8 +305,8 @@ cvs_admin_local(struct cvs_file *cf) > while (!TAILQ_EMPTY(&(cf->file_rcs->rf_access))) { > rap = TAILQ_FIRST(&(cf->file_rcs->rf_access)); > TAILQ_REMOVE(&(cf->file_rcs->rf_access), rap, ra_list); > - xfree(rap->ra_name); > - xfree(rap); > + free(rap->ra_name); > + free(rap); > } > /* no synced anymore */ > cf->file_rcs->rf_flags &= ~RCS_SYNCED; > Index: annotate.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/annotate.c,v > retrieving revision 1.64 > diff -u -p -u -r1.64 annotate.c > --- annotate.c 16 Jan 2015 06:40:06 -0000 1.64 > +++ annotate.c 5 Nov 2015 02:49:20 -0000 > @@ -235,7 +235,7 @@ cvs_annotate_local(struct cvs_file *cf) > p[line->l_len] = '\0'; > > if (line->l_needsfree) > - xfree(line->l_line); > + free(line->l_line); > line->l_line = p; > line->l_len++; > line->l_needsfree = 1; > @@ -244,9 +244,9 @@ cvs_annotate_local(struct cvs_file *cf) > line->l_delta->rd_author, date, line->l_line); > > if (line->l_needsfree) > - xfree(line->l_line); > - xfree(line); > + free(line->l_line); > + free(line); > } > > - xfree(alines); > + free(alines); > } > Index: buf.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/buf.c,v > retrieving revision 1.82 > diff -u -p -u -r1.82 buf.c > --- buf.c 5 Feb 2015 12:59:57 -0000 1.82 > +++ buf.c 5 Nov 2015 02:49:20 -0000 > @@ -119,15 +119,15 @@ buf_load_fd(int fd) > void > buf_free(BUF *b) > { > - if (b->cb_buf != NULL) > - xfree(b->cb_buf); > - xfree(b); > + if (b == NULL) > + return; > + free(b->cb_buf); > + free(b); > } > > /* > * Free the buffer <b>'s structural information but do not free the contents > - * of the buffer. Instead, they are returned and should be freed later using > - * xfree(). > + * of the buffer. Instead, they are returned and should be freed later. > */ > void * > buf_release(BUF *b) > @@ -135,7 +135,7 @@ buf_release(BUF *b) > void *tmp; > > tmp = b->cb_buf; > - xfree(b); > + free(b); > return (tmp); > } > > Index: checkout.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/checkout.c,v > retrieving revision 1.169 > diff -u -p -u -r1.169 checkout.c > --- checkout.c 16 Jan 2015 06:40:06 -0000 1.169 > +++ checkout.c 5 Nov 2015 02:49:21 -0000 > @@ -360,8 +360,7 @@ checkout_check_repository(int argc, char > mc->mc_flags & MODULE_RUN_ON_CHECKOUT) > cvs_exec(mc->mc_prog, NULL, 0); > > - if (module_repo_root != NULL) > - xfree(module_repo_root); > + free(module_repo_root); > } > > if (mc->mc_canfree == 1) { > @@ -371,17 +370,17 @@ checkout_check_repository(int argc, char > &(mc->mc_modules), fl); > RB_REMOVE(cvs_flisthead, > &(mc->mc_modules), fl); > - xfree(fl->file_path); > - xfree(fl); > + free(fl->file_path); > + free(fl); > } > } > > while ((ip = TAILQ_FIRST(&checkout_ign_pats)) != NULL) { > TAILQ_REMOVE(&checkout_ign_pats, ip, ip_list); > - xfree(ip); > + free(ip); > } > > - xfree(mc); > + free(mc); > } > } > > @@ -634,5 +633,5 @@ cvs_checkout_file(struct cvs_file *cf, R > } > } > > - xfree(entry); > + free(entry); > } > Index: client.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/client.c,v > retrieving revision 1.124 > diff -u -p -u -r1.124 client.c > --- client.c 16 Jan 2015 06:40:06 -0000 1.124 > +++ client.c 5 Nov 2015 02:49:21 -0000 > @@ -190,7 +190,7 @@ client_check_directory(char *data, char > entlist = cvs_ent_open(parent); > cvs_ent_add(entlist, entry); > > - xfree(entry); > + free(entry); > } > > void > @@ -273,7 +273,7 @@ cvs_client_connect_to_server(void) > > resp = client_get_supported_responses(); > cvs_client_send_request("Valid-responses %s", resp); > - xfree(resp); > + free(resp); > > cvs_client_send_request("valid-requests"); > cvs_client_get_responses(); > @@ -339,7 +339,7 @@ cvs_client_send_request(char *fmt, ...) > cvs_log(LP_TRACE, "%s", data); > > cvs_remote_output(data); > - xfree(data); > + free(data); > } > > void > @@ -361,7 +361,7 @@ cvs_client_read_response(void) > > (*resp->hdlr)(data); > > - xfree(cmd); > + free(cmd); > } > > void > @@ -391,7 +391,7 @@ cvs_client_send_logmsg(char *msg) > } > } > > - xfree(buf); > + free(buf); > } > > void > @@ -439,16 +439,11 @@ cvs_client_senddir(const char *dir) > > cvs_client_send_request("Sticky %s", buf); > > - if (tag != NULL) > - xfree(tag); > - if (date != NULL) > - xfree(date); > + free(tag); > + free(date); > } > - if (d != NULL) > - xfree(d); > - > - if (lastdir != NULL) > - xfree(lastdir); > + free(d); > + free(lastdir); > lastdir = xstrdup(dir); > } > > @@ -637,12 +632,12 @@ cvs_client_checkedin(char *data) > > dir = cvs_remote_input(); > e = cvs_remote_input(); > - xfree(dir); > + free(dir); > > entlist = cvs_ent_open(data); > newent = cvs_ent_parse(e); > ent = cvs_ent_get(entlist, newent->ce_name); > - xfree(e); > + free(e); > > rcsnum_tostr(newent->ce_rev, rev, sizeof(rev)); > > @@ -685,7 +680,7 @@ cvs_client_checkedin(char *data) > cvs_ent_free(newent); > cvs_ent_add(entlist, entry); > > - xfree(entry); > + free(entry); > } > > void > @@ -730,10 +725,10 @@ cvs_client_updated(char *data) > flen = strtonum(len, 0, INT_MAX, &errstr); > if (errstr != NULL) > fatal("cvs_client_updated: %s: %s", len, errstr); > - xfree(len); > + free(len); > > cvs_strtomode(mode, &fmode); > - xfree(mode); > + free(mode); > fmode &= ~cvs_umask; > > time(&now); > @@ -742,7 +737,7 @@ cvs_client_updated(char *data) > timebuf[strcspn(timebuf, "\n")] = '\0'; > > e = cvs_ent_parse(en); > - xfree(en); > + free(en); > > sticky[0] = '\0'; > if (e->ce_tag != NULL) { > @@ -767,7 +762,7 @@ cvs_client_updated(char *data) > cvs_ent_add(ent, entry); > } > > - xfree(entry); > + free(entry); > > (void)unlink(fpath); > if ((fd = open(fpath, O_CREAT | O_WRONLY | O_TRUNC)) == -1) > @@ -788,7 +783,7 @@ cvs_client_updated(char *data) > > (void)close(fd); > > - xfree(rpath); > + free(rpath); > } > > void > @@ -826,15 +821,15 @@ cvs_client_merged(char *data) > fpath = rpath + strlen(repo) + 1; > if ((wdir = dirname(fpath)) == NULL) > fatal("cvs_client_merged: dirname: %s", strerror(errno)); > - xfree(repo); > + free(repo); > > flen = strtonum(len, 0, INT_MAX, &errstr); > if (errstr != NULL) > fatal("cvs_client_merged: %s: %s", len, errstr); > - xfree(len); > + free(len); > > cvs_strtomode(mode, &fmode); > - xfree(mode); > + free(mode); > fmode &= ~cvs_umask; > > time(&now); > @@ -844,7 +839,7 @@ cvs_client_merged(char *data) > > ent = cvs_ent_open(wdir); > cvs_ent_add(ent, entry); > - xfree(entry); > + free(entry); > > (void)unlink(fpath); > if ((fd = open(fpath, O_CREAT | O_WRONLY | O_TRUNC)) == -1) > @@ -865,7 +860,7 @@ cvs_client_merged(char *data) > > (void)close(fd); > > - xfree(rpath); > + free(rpath); > } > > void > @@ -888,7 +883,7 @@ cvs_client_removed(char *data) > (void)xsnprintf(fpath, PATH_MAX, "%s/%s", data, filename); > (void)unlink(fpath); > > - xfree(rpath); > + free(rpath); > } > > void > @@ -908,7 +903,7 @@ cvs_client_remove_entry(char *data) > entlist = cvs_ent_open(data); > cvs_ent_remove(entlist, filename); > > - xfree(rpath); > + free(rpath); > } > > void > @@ -923,7 +918,7 @@ cvs_client_set_static_directory(char *da > STRIP_SLASH(data); > > dir = cvs_remote_input(); > - xfree(dir); > + free(dir); > > if (cvs_cmdop == CVS_OP_EXPORT) > return; > @@ -949,7 +944,7 @@ cvs_client_clear_static_directory(char * > STRIP_SLASH(data); > > dir = cvs_remote_input(); > - xfree(dir); > + free(dir); > > if (cvs_cmdop == CVS_OP_EXPORT) > return; > @@ -989,8 +984,8 @@ cvs_client_set_sticky(char *data) > (void)fprintf(fp, "%s\n", tag); > (void)fclose(fp); > out: > - xfree(tag); > - xfree(dir); > + free(tag); > + free(dir); > } > > void > @@ -1006,7 +1001,7 @@ cvs_client_clear_sticky(char *data) > dir = cvs_remote_input(); > > if (cvs_cmdop == CVS_OP_EXPORT) { > - xfree(dir); > + free(dir); > return; > } > > @@ -1015,7 +1010,7 @@ cvs_client_clear_sticky(char *data) > (void)xsnprintf(tagpath, PATH_MAX, "%s/%s", data, CVS_PATH_TAG); > (void)unlink(tagpath); > > - xfree(dir); > + free(dir); > } > > > @@ -1054,7 +1049,7 @@ cvs_client_initlog(void) > if (strlcpy(rpath, envdup, sizeof(rpath)) >= sizeof(rpath)) > fatal("cvs_client_initlog: truncation"); > > - xfree(envdup); > + free(envdup); > > s = buf; > while ((s = strchr(s, '%')) != NULL) { > Index: commit.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/commit.c,v > retrieving revision 1.153 > diff -u -p -u -r1.153 commit.c > --- commit.c 16 Jan 2015 06:40:07 -0000 1.153 > +++ commit.c 5 Nov 2015 02:49:21 -0000 > @@ -21,6 +21,7 @@ > #include <errno.h> > #include <fcntl.h> > #include <libgen.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -77,8 +78,7 @@ cvs_commit(int argc, char **argv) > switch (ch) { > case 'F': > /* free previously assigned value */ > - if (logmsg != NULL) > - xfree(logmsg); > + free(logmsg); > logmsg = cvs_logmsg_read(optarg); > Fflag = 1; > break; > @@ -89,8 +89,7 @@ cvs_commit(int argc, char **argv) > break; > case 'm': > /* free previously assigned value */ > - if (logmsg != NULL) > - xfree(logmsg); > + free(logmsg); > logmsg = xstrdup(optarg); > mflag = 1; > break; > @@ -210,7 +209,7 @@ cvs_commit(int argc, char **argv) > cvs_trigger_handle(CVS_TRIGGER_LOGINFO, repo, > loginfo, line_list, &files_info); > > - xfree(loginfo); > + free(loginfo); > cvs_trigger_freelist(line_list); > cvs_trigger_freeinfo(&files_info); > } > @@ -223,8 +222,7 @@ cvs_commit(int argc, char **argv) > > end: > cvs_trigger_freeinfo(&files_info); > - if (logmsg != NULL) > - xfree(logmsg); > + free(logmsg); > return (0); > } > > @@ -568,7 +566,7 @@ cvs_commit_local(struct cvs_file *cf) > "move %s outside the Attic: %s", > cf->file_path, strerror(errno)); > > - xfree(cf->file_rpath); > + free(cf->file_rpath); > cf->file_rpath = xstrdup(rcsfile); > isnew = 0; > } > @@ -761,8 +759,8 @@ commit_diff(struct cvs_file *cf, RCSNUM > close(fd1); > close(fd2); > > - xfree(p1); > - xfree(p2); > + free(p1); > + free(p2); > > return (b); > } > @@ -789,5 +787,5 @@ commit_desc_set(struct cvs_file *cf) > (void)close(fd); > (void)cvs_unlink(desc_path); > > - xfree(desc); > + free(desc); > } > Index: config.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/config.c,v > retrieving revision 1.16 > diff -u -p -u -r1.16 config.c > --- config.c 16 Jan 2015 06:40:07 -0000 1.16 > +++ config.c 5 Nov 2015 02:49:21 -0000 > @@ -48,8 +48,7 @@ config_parse_line(char *line, int lineno > *(val++) = '\0'; > > if (!strcmp(opt, "tag")) { > - if (cvs_tagname != NULL) > - xfree(cvs_tagname); > + free(cvs_tagname); > cvs_tagname = xstrdup(val); > } else if (!strcmp(opt, "umask")) { > cvs_umask = strtol(val, &ep, 8); > @@ -115,8 +114,6 @@ cvs_read_config(char *name, int (*cb)(ch > break; > } > > - if (lbuf != NULL) > - xfree(lbuf); > - > + free(lbuf); > (void)fclose(fp); > } > Index: cvs.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/cvs.c,v > retrieving revision 1.155 > diff -u -p -u -r1.155 cvs.c > --- cvs.c 16 Jan 2015 06:40:07 -0000 1.155 > +++ cvs.c 5 Nov 2015 02:49:21 -0000 > @@ -113,7 +113,7 @@ cvs_cleanup(void) > cvs_log(LP_ERR, > "warning: failed to remove server directory: %s", > cvs_server_path); > - xfree(cvs_server_path); > + free(cvs_server_path); > cvs_server_path = NULL; > } > > @@ -257,7 +257,7 @@ main(int argc, char **argv) > > cvs_getopt(i, targv); > cvs_freeargv(targv, i); > - xfree(targv); > + free(targv); > } > } > > @@ -513,8 +513,7 @@ cvs_read_rcfile(void) > cmd_parsed = 1; > } > } > - if (lbuf != NULL) > - xfree(lbuf); > + free(lbuf); > > if (ferror(fp)) { > cvs_log(LP_NOTICE, "failed to read line from `%s'", rcpath); > @@ -561,7 +560,7 @@ cvs_var_set(const char *var, const char > TAILQ_INSERT_TAIL(&cvs_variables, vp, cv_link); > > } else /* free the previous value */ > - xfree(vp->cv_val); > + free(vp->cv_val); > > vp->cv_val = xstrdup(val); > > @@ -582,9 +581,9 @@ cvs_var_unset(const char *var) > TAILQ_FOREACH(vp, &cvs_variables, cv_link) > if (strcmp(vp->cv_name, var) == 0) { > TAILQ_REMOVE(&cvs_variables, vp, cv_link); > - xfree(vp->cv_name); > - xfree(vp->cv_val); > - xfree(vp); > + free(vp->cv_name); > + free(vp->cv_val); > + free(vp); > return (0); > } > > Index: date.y > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/date.y,v > retrieving revision 1.24 > diff -u -p -u -r1.24 date.y > --- date.y 3 Dec 2013 00:23:45 -0000 1.24 > +++ date.y 5 Nov 2015 02:49:21 -0000 > @@ -488,7 +488,7 @@ yyerror(const char *s) > > (void)xasprintf(&str, "parsing date string: %s", s); > cvs_log(LP_ERR, "%s", str); > - xfree(str); > + free(str); > #endif > return (0); > } > Index: diff.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/diff.c,v > retrieving revision 1.160 > diff -u -p -u -r1.160 diff.c > --- diff.c 20 Apr 2011 18:33:13 -0000 1.160 > +++ diff.c 5 Nov 2015 02:49:21 -0000 > @@ -605,20 +605,18 @@ cvs_diff_local(struct cvs_file *cf) > > worklist_run(&temp_files, worklist_unlink); > > - if (p1 != NULL) > - xfree(p1); > - if (p2 != NULL) > - xfree(p2); > + free(p1); > + free(p2); > > cleanup: > if (diff_rev1 != NULL && > (cf->file_rcs == NULL || diff_rev1 != cf->file_rcs->rf_head) && > (cf->file_ent == NULL || diff_rev1 != cf->file_ent->ce_rev)) > - xfree(diff_rev1); > + free(diff_rev1); > diff_rev1 = NULL; > > if (diff_rev2 != NULL && > (cf->file_rcs == NULL || diff_rev2 != cf->file_rcs->rf_head)) > - xfree(diff_rev2); > + free(diff_rev2); > diff_rev2 = NULL; > } > Index: diff3.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/diff3.c,v > retrieving revision 1.58 > diff -u -p -u -r1.58 diff3.c > --- diff3.c 5 Sep 2015 09:47:08 -0000 1.58 > +++ diff3.c 5 Nov 2015 02:49:21 -0000 > @@ -257,20 +257,19 @@ cvs_merge_file(struct cvs_file *cf, int > > cvs_freelines(dlines); > > - if (data != NULL) > - xfree(data); > - xfree(patch); > + free(data); > + free(patch); > > for (i = 0; i < 3; i++) > fclose(fp[i]); > > worklist_run(&temp_files, worklist_unlink); > > - xfree(path1); > - xfree(path2); > - xfree(path3); > - xfree(dp13); > - xfree(dp23); > + free(path1); > + free(path2); > + free(path3); > + free(dp13); > + free(dp23); > } > > static int > @@ -291,17 +290,12 @@ diff3_internal(int argc, char **argv, co > szchanges = 0; > memset(last, 0, sizeof(last)); > memset(cline, 0, sizeof(cline)); > - if (d13 != NULL) > - xfree(d13); > - if (d23 != NULL) > - xfree(d23); > - if (overlap != NULL) > - xfree(overlap); > - if (de != NULL) > - xfree(de); > + free(d13); > + free(d23); > + free(overlap); > + free(de); > > - overlap = NULL; > - de = d13 = d23 = NULL; > + de = d13 = d23 = overlap = NULL; > > increase(); > > Index: diff_internals.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/diff_internals.c,v > retrieving revision 1.37 > diff -u -p -u -r1.37 diff_internals.c > --- diff_internals.c 5 Feb 2015 12:59:57 -0000 1.37 > +++ diff_internals.c 5 Nov 2015 02:49:21 -0000 > @@ -73,6 +73,7 @@ > #include <stddef.h> > #include <stdint.h> > #include <stdio.h> > +#include <stdlib.h> > #include <string.h> > #include <time.h> > #include <unistd.h> > @@ -392,13 +393,13 @@ diffreg(const char *file1, const char *f > clistlen = 100; > clist = xcalloc(clistlen, sizeof(*clist)); > i = stone(class, slen[0], member, klist, flags); > - xfree(member); > - xfree(class); > + free(member); > + free(class); > > J = xreallocarray(J, len[0] + 2, sizeof(*J)); > unravel(klist[i]); > - xfree(clist); > - xfree(klist); > + free(clist); > + free(klist); > > ixold = xreallocarray(ixold, len[0] + 2, sizeof(*ixold)); > ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew)); > @@ -787,7 +788,7 @@ unsort(struct line *f, int l, int *b) > a[f[i].serial] = f[i].value; > for (i = 1; i <= l; i++) > b[i] = a[i]; > - xfree(a); > + free(a); > } > > static int > @@ -878,7 +879,7 @@ ignoreline(char *line) > int ret; > > ret = regexec(&ignore_re, line, 0, NULL, 0); > - xfree(line); > + free(line); > return (ret == 0); /* if it matched, it should be ignored. */ > } > > @@ -1456,5 +1457,5 @@ diff_output(const char *fmt, ...) > buf_puts(diffbuf, str); > else > cvs_printf("%s", str); > - xfree(str); > + free(str); > } > Index: edit.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/edit.c,v > retrieving revision 1.50 > diff -u -p -u -r1.50 edit.c > --- edit.c 16 Jan 2015 06:40:07 -0000 1.50 > +++ edit.c 5 Nov 2015 02:49:21 -0000 > @@ -18,6 +18,7 @@ > #include <sys/stat.h> > > #include <errno.h> > +#include <stdlib.h> > #include <string.h> > #include <time.h> > #include <unistd.h> > @@ -409,7 +410,7 @@ cvs_unedit_local(struct cvs_file *cf) > > cvs_ent_free(ent); > > - xfree(entry); > + free(entry); > } > > rcsnum_free(ba_rev); > Index: entries.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/entries.c,v > retrieving revision 1.105 > diff -u -p -u -r1.105 entries.c > --- entries.c 20 Aug 2015 22:32:41 -0000 1.105 > +++ entries.c 5 Nov 2015 02:49:21 -0000 > @@ -16,6 +16,7 @@ > */ > > #include <errno.h> > +#include <stdlib.h> > #include <string.h> > #include <time.h> > #include <unistd.h> > @@ -101,8 +102,8 @@ cvs_ent_open(const char *dir) > if (line != NULL) { > TAILQ_REMOVE(&(ep->cef_ent), line, > entries_list); > - xfree(line->buf); > - xfree(line); > + free(line->buf); > + free(line); > } > cvs_ent_free(ent); > } > @@ -276,8 +277,8 @@ cvs_ent_close(CVSENTRIES *ep, int writef > } > > TAILQ_REMOVE(&(ep->cef_ent), l, entries_list); > - xfree(l->buf); > - xfree(l); > + free(l->buf); > + free(l); > } > > if (fp != NULL) { > @@ -294,10 +295,10 @@ cvs_ent_close(CVSENTRIES *ep, int writef > (void)unlink(ep->cef_lpath); > } > > - xfree(ep->cef_path); > - xfree(ep->cef_bpath); > - xfree(ep->cef_lpath); > - xfree(ep); > + free(ep->cef_path); > + free(ep->cef_bpath); > + free(ep->cef_lpath); > + free(ep); > } > > void > @@ -358,8 +359,8 @@ cvs_ent_remove(CVSENTRIES *ep, const cha > (void)fclose(fp); > > TAILQ_REMOVE(&(ep->cef_ent), l, entries_list); > - xfree(l->buf); > - xfree(l); > + free(l->buf); > + free(l); > } > > /* > @@ -386,11 +387,9 @@ cvs_ent_free(struct cvs_ent *ent) > { > if (ent->ce_rev != NULL) > rcsnum_free(ent->ce_rev); > - if (ent->ce_time != NULL) > - xfree(ent->ce_time); > - > - xfree(ent->ce_buf); > - xfree(ent); > + free(ent->ce_time); > + free(ent->ce_buf); > + free(ent); > } > > static struct cvs_ent_line * > Index: file.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/file.c,v > retrieving revision 1.266 > diff -u -p -u -r1.266 file.c > --- file.c 20 Aug 2015 22:32:41 -0000 1.266 > +++ file.c 5 Nov 2015 02:49:21 -0000 > @@ -36,6 +36,7 @@ > #include <fnmatch.h> > #include <libgen.h> > #include <stdint.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -375,10 +376,8 @@ cvs_file_walklist(struct cvs_flisthead * > if (l->flags & FILE_USER_SUPPLIED) { > if (cmdp->cmd_flags & CVS_LOCK_REPO) > cvs_repository_unlock(repo); > - if (cvs_directory_tag != NULL) { > - xfree(cvs_directory_tag); > - cvs_directory_tag = NULL; > - } > + free(cvs_directory_tag); > + cvs_directory_tag = NULL; > } > } > > @@ -562,11 +561,11 @@ cvs_file_walkdir(struct cvs_file *cf, st > fatal("cvs_file_walkdir: %s %s", cf->file_path, > strerror(errno)); > > - xfree(buf); > + free(buf); > > while ((ip = TAILQ_FIRST(&dir_ign_pats)) != NULL) { > TAILQ_REMOVE(&dir_ign_pats, ip, ip_list); > - xfree(ip); > + free(ip); > } > > entlist = cvs_ent_open(cf->file_path); > @@ -613,7 +612,7 @@ walkrepo: > > if (cvs_directory_tag != NULL && cmdp->cmd_flags & CVS_USE_WDIR) { > cvs_write_tagfile(cf->file_path, cvs_directory_tag, NULL); > - xfree(cvs_directory_tag); > + free(cvs_directory_tag); > cvs_directory_tag = NULL; > } > > @@ -632,8 +631,8 @@ cvs_file_freelist(struct cvs_flisthead * > for (f = RB_MIN(cvs_flisthead, fl); f != NULL; f = nxt) { > nxt = RB_NEXT(cvs_flisthead, fl, f); > RB_REMOVE(cvs_flisthead, fl, f); > - xfree(f->file_path); > - xfree(f); > + free(f->file_path); > + free(f); > } > } > > @@ -754,7 +753,7 @@ cvs_file_classify(struct cvs_file *cf, c > > cf->repo_fd = open(rcsfile, O_RDONLY); > if (cf->repo_fd != -1) { > - xfree(cf->file_rpath); > + free(cf->file_rpath); > cf->file_rpath = xstrdup(rcsfile); > cf->file_rcs = rcs_open(cf->file_rpath, > cf->repo_fd, rflags); > @@ -975,14 +974,13 @@ cvs_file_classify(struct cvs_file *cf, c > void > cvs_file_free(struct cvs_file *cf) > { > - xfree(cf->file_name); > - xfree(cf->file_wd); > - xfree(cf->file_path); > + free(cf->file_name); > + free(cf->file_wd); > + free(cf->file_path); > > if (cf->file_rcsrev != NULL) > rcsnum_free(cf->file_rcsrev); > - if (cf->file_rpath != NULL) > - xfree(cf->file_rpath); > + free(cf->file_rpath); > if (cf->file_ent != NULL) > cvs_ent_free(cf->file_ent); > if (cf->file_rcs != NULL) > @@ -991,7 +989,7 @@ cvs_file_free(struct cvs_file *cf) > (void)close(cf->fd); > if (cf->repo_fd != -1) > (void)close(cf->repo_fd); > - xfree(cf); > + free(cf); > } > > int > Index: history.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/history.c,v > retrieving revision 1.42 > diff -u -p -u -r1.42 history.c > --- history.c 16 Jan 2015 06:40:07 -0000 1.42 > +++ history.c 5 Nov 2015 02:49:21 -0000 > @@ -181,9 +181,9 @@ cvs_history_add(int type, struct cvs_fil > } > > if (rev != revbuf) > - xfree(rev); > + free(rev); > if (cvs_server_active != 1) > - xfree(cwd); > + free(cwd); > } > > static void > Index: import.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/import.c,v > retrieving revision 1.104 > diff -u -p -u -r1.104 import.c > --- import.c 16 Jan 2015 06:40:07 -0000 1.104 > +++ import.c 5 Nov 2015 02:49:21 -0000 > @@ -19,6 +19,7 @@ > > #include <errno.h> > #include <fcntl.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -191,7 +192,7 @@ cvs_import(int argc, char **argv) > cvs_trigger_freelist(line_list); > } > > - xfree(loginfo); > + free(loginfo); > return (0); > } > > @@ -209,7 +210,7 @@ import_printf(const char *fmt, ...) > cvs_printf("%s", str); > buf_puts(logbuf, str); > > - xfree(str); > + free(str); > } > > void > @@ -482,8 +483,8 @@ import_get_rcsdiff(struct cvs_file *cf, > (void)unlink(p1); > (void)unlink(p2); > > - xfree(p1); > - xfree(p2); > + free(p1); > + free(p2); > > return (b2); > } > Index: log.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/log.c,v > retrieving revision 1.46 > diff -u -p -u -r1.46 log.c > --- log.c 27 Dec 2011 13:59:01 -0000 1.46 > +++ log.c 5 Nov 2015 02:49:21 -0000 > @@ -26,6 +26,7 @@ > */ > > #include <errno.h> > +#include <stdlib.h> > #include <string.h> > > #include "cvs.h" > @@ -162,7 +163,7 @@ cvs_printf(const char *fmt, ...) > dp = sp + 1; > } > > - xfree(nstr); > + free(nstr); > va_end(vap); > > return (ret); > Index: logmsg.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/logmsg.c,v > retrieving revision 1.56 > diff -u -p -u -r1.56 logmsg.c > --- logmsg.c 5 Feb 2015 12:59:57 -0000 1.56 > +++ logmsg.c 5 Nov 2015 02:49:21 -0000 > @@ -83,8 +83,7 @@ cvs_logmsg_read(const char *path) > buf_putc(bp, '\n'); > } > > - if (lbuf != NULL) > - xfree(lbuf); > + free(lbuf); > > (void)fclose(fp); > > @@ -149,7 +148,7 @@ cvs_logmsg_create(char *dir, struct cvs_ > logmsg = xmalloc(st.st_size); > fread(logmsg, st.st_size, 1, rp); > fwrite(logmsg, st.st_size, 1, fp); > - xfree(logmsg); > + free(logmsg); > (void)fclose(rp); > } > cvs_trigger_freelist(line_list); > @@ -215,8 +214,7 @@ cvs_logmsg_create(char *dir, struct cvs_ > > if (st1.st_mtime != st2.st_mtime) { > logmsg = cvs_logmsg_read(fpath); > - if (prevmsg != NULL) > - xfree(prevmsg); > + free(prevmsg); > prevmsg = xstrdup(logmsg); > break; > } > @@ -250,7 +248,7 @@ cvs_logmsg_create(char *dir, struct cvs_ > > (void)fclose(fp); > (void)unlink(fpath); > - xfree(fpath); > + free(fpath); > > return (logmsg); > } > @@ -284,7 +282,7 @@ cvs_logmsg_edit(const char *pathname) > while (waitpid(pid, &st, 0) == -1) > if (errno != EINTR) > goto fail; > - xfree(p); > + free(p); > (void)signal(SIGHUP, sighup); > (void)signal(SIGINT, sigint); > (void)signal(SIGQUIT, sigquit); > @@ -299,7 +297,7 @@ cvs_logmsg_edit(const char *pathname) > (void)signal(SIGHUP, sighup); > (void)signal(SIGINT, sigint); > (void)signal(SIGQUIT, sigquit); > - xfree(p); > + free(p); > errno = saved_errno; > return (-1); > } > @@ -334,7 +332,7 @@ cvs_logmsg_verify(char *logmsg) > cvs_trigger_freeinfo(&files_info); > (void)close(fd); > (void)unlink(fpath); > - xfree(fpath); > + free(fpath); > cvs_trigger_freelist(line_list); > } > > Index: modules.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/modules.c,v > retrieving revision 1.18 > diff -u -p -u -r1.18 modules.c > --- modules.c 16 Jan 2015 06:40:07 -0000 1.18 > +++ modules.c 5 Nov 2015 02:49:21 -0000 > @@ -207,9 +207,8 @@ modules_parse_line(char *line, int linen > return (0); > > bad: > - if (prog != NULL) > - xfree(prog); > - xfree(bline); > + free(prog); > + free(bline); > cvs_log(LP_NOTICE, "malformed line in CVSROOT/modules: %d", lineno); > return (0); > } > Index: rcs.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/rcs.c,v > retrieving revision 1.312 > diff -u -p -u -r1.312 rcs.c > --- rcs.c 16 Jan 2015 06:40:07 -0000 1.312 > +++ rcs.c 5 Nov 2015 02:49:21 -0000 > @@ -236,24 +236,24 @@ rcs_close(RCSFILE *rfp) > while (!TAILQ_EMPTY(&(rfp->rf_access))) { > rap = TAILQ_FIRST(&(rfp->rf_access)); > TAILQ_REMOVE(&(rfp->rf_access), rap, ra_list); > - xfree(rap->ra_name); > - xfree(rap); > + free(rap->ra_name); > + free(rap); > } > > while (!TAILQ_EMPTY(&(rfp->rf_symbols))) { > rsp = TAILQ_FIRST(&(rfp->rf_symbols)); > TAILQ_REMOVE(&(rfp->rf_symbols), rsp, rs_list); > rcsnum_free(rsp->rs_num); > - xfree(rsp->rs_name); > - xfree(rsp); > + free(rsp->rs_name); > + free(rsp); > } > > while (!TAILQ_EMPTY(&(rfp->rf_locks))) { > rlp = TAILQ_FIRST(&(rfp->rf_locks)); > TAILQ_REMOVE(&(rfp->rf_locks), rlp, rl_list); > rcsnum_free(rlp->rl_num); > - xfree(rlp->rl_name); > - xfree(rlp); > + free(rlp->rl_name); > + free(rlp); > } > > if (rfp->rf_head != NULL) > @@ -263,17 +263,13 @@ rcs_close(RCSFILE *rfp) > > if (rfp->rf_file != NULL) > fclose(rfp->rf_file); > - if (rfp->rf_path != NULL) > - xfree(rfp->rf_path); > - if (rfp->rf_comment != NULL) > - xfree(rfp->rf_comment); > - if (rfp->rf_expand != NULL) > - xfree(rfp->rf_expand); > - if (rfp->rf_desc != NULL) > - xfree(rfp->rf_desc); > + free(rfp->rf_path); > + free(rfp->rf_comment); > + free(rfp->rf_expand); > + free(rfp->rf_desc); > if (rfp->rf_pdata != NULL) > rcsparse_free(rfp); > - xfree(rfp); > + free(rfp); > } > > /* > @@ -438,9 +434,7 @@ rcs_write(RCSFILE *rfp) > } > > rfp->rf_flags |= RCS_SYNCED; > - > - if (fn != NULL) > - xfree(fn); > + free(fn); > } > > /* > @@ -623,8 +617,8 @@ rcs_access_remove(RCSFILE *file, const c > return (-1); > > TAILQ_REMOVE(&(file->rf_access), ap, ra_list); > - xfree(ap->ra_name); > - xfree(ap); > + free(ap->ra_name); > + free(ap); > > /* not synced anymore */ > file->rf_flags &= ~RCS_SYNCED; > @@ -687,9 +681,9 @@ rcs_sym_remove(RCSFILE *file, const char > return (-1); > > TAILQ_REMOVE(&(file->rf_symbols), symp, rs_list); > - xfree(symp->rs_name); > + free(symp->rs_name); > rcsnum_free(symp->rs_num); > - xfree(symp); > + free(symp); > > /* not synced anymore */ > file->rf_flags &= ~RCS_SYNCED; > @@ -865,8 +859,8 @@ rcs_lock_remove(RCSFILE *file, const cha > > TAILQ_REMOVE(&(file->rf_locks), lkp, rl_list); > rcsnum_free(lkp->rl_num); > - xfree(lkp->rl_name); > - xfree(lkp); > + free(lkp->rl_name); > + free(lkp); > > /* not synced anymore */ > file->rf_flags &= ~RCS_SYNCED; > @@ -895,8 +889,7 @@ rcs_desc_set(RCSFILE *file, const char * > char *tmp; > > tmp = xstrdup(desc); > - if (file->rf_desc != NULL) > - xfree(file->rf_desc); > + free(file->rf_desc); > file->rf_desc = tmp; > file->rf_flags &= ~RCS_SYNCED; > } > @@ -945,8 +938,7 @@ rcs_comment_set(RCSFILE *file, const cha > char *tmp; > > tmp = xstrdup(comment); > - if (file->rf_comment != NULL) > - xfree(file->rf_comment); > + free(file->rf_comment); > file->rf_comment = tmp; > file->rf_flags &= ~RCS_SYNCED; > } > @@ -1011,7 +1003,7 @@ rcs_patch_lines(struct rcs_lines *dlines > alines[dlp->l_lineno_orig - 1] = > dlp; > } else > - xfree(dlp); > + free(dlp); > dlp = ndlp; > /* last line is gone - reset dlp */ > if (dlp == NULL) { > @@ -1029,7 +1021,7 @@ rcs_patch_lines(struct rcs_lines *dlines > TAILQ_REMOVE(&(plines->l_lines), lp, l_list); > if (alines != NULL) { > if (lp->l_needsfree == 1) > - xfree(lp->l_line); > + free(lp->l_line); > lp->l_line = NULL; > lp->l_needsfree = 0; > } > @@ -1137,8 +1129,7 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, co > if (rf->rf_flags & RCS_CREATE) { > if ((rev = rcsnum_parse(RCS_HEAD_INIT)) == NULL) > return (-1); > - if (rf->rf_head != NULL) > - xfree(rf->rf_head); > + free(rf->rf_head); > rf->rf_head = rev; > } else if (rf->rf_head == NULL) { > return (-1); > @@ -1312,14 +1303,9 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) > rf->rf_flags &= ~RCS_SYNCED; > > rcs_freedelta(rdp); > - > - if (newdeltatext != NULL) > - xfree(newdeltatext); > - > - if (path_tmp1 != NULL) > - xfree(path_tmp1); > - if (path_tmp2 != NULL) > - xfree(path_tmp2); > + free(newdeltatext); > + free(path_tmp1); > + free(path_tmp2); > > return (0); > } > @@ -1395,8 +1381,7 @@ rcs_kwexp_set(RCSFILE *file, int mode) > } > > tmp = xstrdup(buf); > - if (file->rf_expand != NULL) > - xfree(file->rf_expand); > + free(file->rf_expand); > file->rf_expand = tmp; > /* not synced anymore */ > file->rf_flags &= ~RCS_SYNCED; > @@ -1471,24 +1456,19 @@ rcs_freedelta(struct rcs_delta *rdp) > if (rdp->rd_next != NULL) > rcsnum_free(rdp->rd_next); > > - if (rdp->rd_author != NULL) > - xfree(rdp->rd_author); > - if (rdp->rd_locker != NULL) > - xfree(rdp->rd_locker); > - if (rdp->rd_state != NULL) > - xfree(rdp->rd_state); > - if (rdp->rd_log != NULL) > - xfree(rdp->rd_log); > - if (rdp->rd_text != NULL) > - xfree(rdp->rd_text); > + free(rdp->rd_author); > + free(rdp->rd_locker); > + free(rdp->rd_state); > + free(rdp->rd_log); > + free(rdp->rd_text); > > while ((rb = TAILQ_FIRST(&(rdp->rd_branches))) != NULL) { > TAILQ_REMOVE(&(rdp->rd_branches), rb, rb_list); > rcsnum_free(rb->rb_num); > - xfree(rb); > + free(rb); > } > > - xfree(rdp); > + free(rdp); > } > > /* > @@ -1540,8 +1520,7 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM * > if ((rdp = rcs_findrev(rfp, rev)) == NULL) > return (-1); > > - if (rdp->rd_text != NULL) > - xfree(rdp->rd_text); > + free(rdp->rd_text); > > len = buf_len(bp); > dtext = buf_release(bp); > @@ -1556,9 +1535,7 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM * > rdp->rd_tlen = 0; > } > > - if (dtext != NULL) > - xfree(dtext); > - > + free(dtext); > return (0); > } > > @@ -1575,8 +1552,7 @@ rcs_rev_setlog(RCSFILE *rfp, RCSNUM *rev > if ((rdp = rcs_findrev(rfp, rev)) == NULL) > return (-1); > > - if (rdp->rd_log != NULL) > - xfree(rdp->rd_log); > + free(rdp->rd_log); > > rdp->rd_log = xstrdup(logtext); > rfp->rf_flags &= ~RCS_SYNCED; > @@ -1615,8 +1591,7 @@ rcs_state_set(RCSFILE *rfp, RCSNUM *rev, > if ((rdp = rcs_findrev(rfp, rev)) == NULL) > return (-1); > > - if (rdp->rd_state != NULL) > - xfree(rdp->rd_state); > + free(rdp->rd_state); > > rdp->rd_state = xstrdup(state); > > @@ -1899,8 +1874,7 @@ next: > > if (brp == NULL) { > if (annotate != ANNOTATE_NEVER) { > - if (*alines != NULL) > - xfree(*alines); > + free(*alines); > *alines = NULL; > cvs_freelines(dlines); > rcsnum_free(bnum); > @@ -1922,7 +1896,7 @@ done: > nline = TAILQ_NEXT(line, l_list); > TAILQ_REMOVE(&(dlines->l_lines), line, l_list); > if (line->l_line == NULL) { > - xfree(line); > + free(line); > continue; > } > > @@ -2039,7 +2013,7 @@ rcs_annotate_getlines(RCSFILE *rfp, RCSN > * All lines have been parsed, now they must be copied over > * into alines (array) again. > */ > - xfree(*alines); > + free(*alines); > > i = 0; > TAILQ_FOREACH(line, &(dlines->l_lines), l_list) { > @@ -2486,7 +2460,7 @@ rcs_kwexp_line(char *rcsfile, struct rcs > cur, lp, l_list); > cur = lp; > } > - xfree(logp); > + free(logp); > > /* > * This is just another hairy mess, but it must > @@ -2509,8 +2483,8 @@ rcs_kwexp_line(char *rcsfile, struct rcs > > end = line->l_line + line->l_len - 1; > > - xfree(prefix); > - xfree(sprefix); > + free(prefix); > + free(sprefix); > > } > > @@ -2561,7 +2535,7 @@ rcs_kwexp_line(char *rcsfile, struct rcs > > /* tmpbuf is now ready, convert to string */ > if (line->l_needsfree) > - xfree(line->l_line); > + free(line->l_line); > line->l_len = len; > line->l_line = buf_release(tmpbuf); > line->l_needsfree = 1; > Index: rcsnum.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/rcsnum.c,v > retrieving revision 1.56 > diff -u -p -u -r1.56 rcsnum.c > --- rcsnum.c 16 Jan 2015 06:40:07 -0000 1.56 > +++ rcsnum.c 5 Nov 2015 02:49:21 -0000 > @@ -25,6 +25,7 @@ > */ > > #include <ctype.h> > +#include <stdlib.h> > #include <string.h> > > #include "cvs.h" > @@ -96,7 +97,7 @@ rcsnum_parse(const char *str) > void > rcsnum_free(RCSNUM *rn) > { > - xfree(rn); > + free(rn); > } > > /* > Index: rcsparse.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/rcsparse.c,v > retrieving revision 1.11 > diff -u -p -u -r1.11 rcsparse.c > --- rcsparse.c 1 Dec 2014 21:58:46 -0000 1.11 > +++ rcsparse.c 5 Nov 2015 02:49:21 -0000 > @@ -341,11 +341,10 @@ rcsparse_free(RCSFILE *rfp) > > pdp = rfp->rf_pdata; > > - if (pdp->rp_buf != NULL) > - xfree(pdp->rp_buf); > + free(pdp->rp_buf); > if (pdp->rp_token == RCS_TYPE_REVISION) > rcsnum_free(pdp->rp_value.rev); > - xfree(pdp); > + free(pdp); > } > > /* > @@ -610,7 +609,7 @@ rcsparse_text(RCSFILE *rfp, struct rcs_p > memcpy(pdp->rp_delta->rd_text, pdp->rp_buf, > pdp->rp_delta->rd_tlen); > } > - xfree(pdp->rp_value.str); > + free(pdp->rp_value.str); > > return (0); > } > @@ -708,7 +707,7 @@ rcsparse_symbols(RCSFILE *rfp, struct rc > name = pdp->rp_value.str; > if (rcsparse_token(rfp, RCS_TOK_COLON) != RCS_TOK_COLON || > rcsparse_token(rfp, RCS_TYPE_NUMBER) != RCS_TYPE_NUMBER) { > - xfree(name); > + free(name); > return (1); > } > symp = xmalloc(sizeof(*symp)); > @@ -742,7 +741,7 @@ rcsparse_locks(RCSFILE *rfp, struct rcs_ > if (rcsparse_token(rfp, RCS_TOK_COLON) != RCS_TOK_COLON || > rcsparse_token(rfp, RCS_TYPE_REVISION) != > RCS_TYPE_REVISION) { > - xfree(name); > + free(name); > return (1); > } > lkp = xmalloc(sizeof(*lkp)); > Index: remote.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/remote.c,v > retrieving revision 1.30 > diff -u -p -u -r1.30 remote.c > --- remote.c 16 Jan 2015 06:40:07 -0000 1.30 > +++ remote.c 5 Nov 2015 02:49:21 -0000 > @@ -239,7 +239,7 @@ cvs_remote_send_file_buf(char *file, BUF > atomicio(vwrite, cvs_client_inlog_fd, data, len) != len) > fatal("failed to write to log file"); > > - xfree(data); > + free(data); > } > > void > @@ -309,5 +309,5 @@ cvs_validate_directory(const char *path) > fatal("path validation failed!"); > } > > - xfree(dir); > + free(dir); > } > Index: remove.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/remove.c,v > retrieving revision 1.82 > diff -u -p -u -r1.82 remove.c > --- remove.c 16 Jan 2015 06:40:07 -0000 1.82 > +++ remove.c 5 Nov 2015 02:49:21 -0000 > @@ -16,6 +16,7 @@ > */ > > #include <errno.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -212,7 +213,7 @@ cvs_remove_local(struct cvs_file *cf) > cvs_ent_add(entlist, entry); > } > > - xfree(entry); > + free(entry); > > if (verbosity > 0) { > cvs_log(LP_NOTICE, > Index: server.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/server.c,v > retrieving revision 1.102 > diff -u -p -u -r1.102 server.c > --- server.c 16 Jan 2015 06:40:07 -0000 1.102 > +++ server.c 5 Nov 2015 02:49:21 -0000 > @@ -138,7 +138,7 @@ cvs_server(int argc, char **argv) > "the `Directory` request first", cmd); > > (*req->hdlr)(data); > - xfree(cmd); > + free(cmd); > } > > return (0); > @@ -159,7 +159,7 @@ cvs_server_send_response(char *fmt, ...) > > cvs_log(LP_TRACE, "%s", data); > cvs_remote_output(data); > - xfree(data); > + free(data); > } > > void > @@ -237,7 +237,7 @@ cvs_server_validreq(char *data) > > cvs_server_send_response("Valid-requests %s", d); > cvs_server_send_response("ok"); > - xfree(d); > + free(d); > } > > void > @@ -363,14 +363,14 @@ cvs_server_directory(char *data) > > entlist = cvs_ent_open(parent); > cvs_ent_add(entlist, entry); > - xfree(entry); > + free(entry); > } > > if (server_currentdir != NULL) > - xfree(server_currentdir); > + free(server_currentdir); > server_currentdir = p; > > - xfree(dir); > + free(dir); > } > > void > @@ -404,12 +404,12 @@ cvs_server_modified(char *data) > len = cvs_remote_input(); > > cvs_strtomode(mode, &fmode); > - xfree(mode); > + free(mode); > > flen = strtonum(len, 0, INT_MAX, &errstr); > if (errstr != NULL) > fatal("cvs_server_modified: %s", errstr); > - xfree(len); > + free(len); > > (void)xsnprintf(fpath, PATH_MAX, "%s/%s", server_currentdir, data); > > @@ -829,6 +829,6 @@ cvs_server_exp_modules(char *module) > cvs_server_send_response("ok"); > > server_argc--; > - xfree(server_argv[1]); > + free(server_argv[1]); > server_argv[1] = NULL; > } > Index: tag.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/tag.c,v > retrieving revision 1.81 > diff -u -p -u -r1.81 tag.c > --- tag.c 16 Jan 2015 06:40:07 -0000 1.81 > +++ tag.c 5 Nov 2015 02:49:21 -0000 > @@ -16,6 +16,7 @@ > */ > > #include <errno.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -308,19 +309,14 @@ cvs_tag_check_files(struct cvs_file *cf) > return; > > bad: > - if (fi->file_path != NULL) > - xfree(fi->file_path); > - if (fi->crevstr != NULL) > - xfree(fi->crevstr); > - if (fi->nrevstr != NULL) > - xfree(fi->nrevstr); > - if (fi->tag_new != NULL) > - xfree(fi->tag_new); > - if (fi->tag_old != NULL) > - xfree(fi->tag_old); > + free(fi->file_path); > + free(fi->crevstr); > + free(fi->nrevstr); > + free(fi->tag_new); > + free(fi->tag_old); > if (rev != NULL) > rcsnum_free(rev); > - xfree(fi); > + free(fi); > } > > void > Index: trigger.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/trigger.c,v > retrieving revision 1.22 > diff -u -p -u -r1.22 trigger.c > --- trigger.c 16 Jan 2015 06:40:07 -0000 1.22 > +++ trigger.c 5 Nov 2015 02:49:21 -0000 > @@ -322,8 +322,7 @@ again: > expanded = 1; > } > > - if (q != NULL) > - xfree(q); > + free(q); > } > > if (!expanded && default_args != NULL) { > @@ -336,8 +335,7 @@ again: > return (buf_release(buf)); > > bad: > - if (q != NULL) > - xfree(q); > + free(q); > cvs_log(LP_NOTICE, "%s contains malformed command '%s'", file, cmd); > buf_free(buf); > return (NULL); > @@ -359,7 +357,7 @@ cvs_trigger_handle(int type, char *repo, > case CVS_TRIGGER_TAGINFO: > case CVS_TRIGGER_VERIFYMSG: > if ((r = cvs_exec(cmd, NULL, 1)) != 0) { > - xfree(cmd); > + free(cmd); > return (r); > } > break; > @@ -367,7 +365,7 @@ cvs_trigger_handle(int type, char *repo, > (void)cvs_exec(cmd, in, 1); > break; > } > - xfree(cmd); > + free(cmd); > } > > return (0); > @@ -460,8 +458,7 @@ cvs_trigger_getlines(char * file, char * > } > } > > - if (nline != NULL) > - xfree(nline); > + free(nline); > > if (defaultline != NULL) { > if (!match) { > @@ -469,13 +466,13 @@ cvs_trigger_getlines(char * file, char * > tline->line = defaultline; > TAILQ_INSERT_HEAD(list, tline, flist); > } else > - xfree(defaultline); > + free(defaultline); > } > > (void)fclose(fp); > > if (TAILQ_EMPTY(list)) { > - xfree(list); > + free(list); > list = NULL; > } > > @@ -483,9 +480,7 @@ cvs_trigger_getlines(char * file, char * > > bad: > cvs_log(LP_NOTICE, "%s: malformed line %d", file, lineno); > - > - if (defaultline != NULL) > - xfree(defaultline); > + free(defaultline); > cvs_trigger_freelist(list); > > (void)fclose(fp); > @@ -500,11 +495,11 @@ cvs_trigger_freelist(struct trigger_list > > while ((line = TAILQ_FIRST(list)) != NULL) { > TAILQ_REMOVE(list, line, flist); > - xfree(line->line); > - xfree(line); > + free(line->line); > + free(line); > } > > - xfree(list); > + free(list); > } > > void > @@ -515,20 +510,13 @@ cvs_trigger_freeinfo(struct file_info_li > while ((fi = TAILQ_FIRST(list)) != NULL) { > TAILQ_REMOVE(list, fi, flist); > > - if (fi->file_path != NULL) > - xfree(fi->file_path); > - if (fi->file_wd != NULL) > - xfree(fi->file_wd); > - if (fi->crevstr != NULL) > - xfree(fi->crevstr); > - if (fi->nrevstr != NULL) > - xfree(fi->nrevstr); > - if (fi->tag_new != NULL) > - xfree(fi->tag_new); > - if (fi->tag_old != NULL) > - xfree(fi->tag_old); > - > - xfree(fi); > + free(fi->file_path); > + free(fi->file_wd); > + free(fi->crevstr); > + free(fi->nrevstr); > + free(fi->tag_new); > + free(fi->tag_old); > + free(fi); > } > } > > Index: update.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/update.c,v > retrieving revision 1.170 > diff -u -p -u -r1.170 update.c > --- update.c 5 Feb 2015 12:59:57 -0000 1.170 > +++ update.c 5 Nov 2015 02:49:21 -0000 > @@ -21,6 +21,7 @@ > #include <errno.h> > #include <fcntl.h> > #include <stdint.h> > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -203,8 +204,7 @@ cvs_update_enterdir(struct cvs_file *cf) > cvs_parse_tagfile(cf->file_wd, &dirtag, NULL, NULL); > cvs_mkpath(cf->file_path, cvs_specified_tag != NULL ? > cvs_specified_tag : dirtag); > - if (dirtag != NULL) > - xfree(dirtag); > + free(dirtag); > > if ((cf->fd = open(cf->file_path, O_RDONLY)) == -1) > fatal("cvs_update_enterdir: `%s': %s", > @@ -218,7 +218,7 @@ cvs_update_enterdir(struct cvs_file *cf) > > entlist = cvs_ent_open(cf->file_wd); > cvs_ent_add(entlist, entry); > - xfree(entry); > + free(entry); > } > } else if ((cf->file_status == DIR_CREATE && build_dirs == 0) || > cf->file_status == FILE_UNKNOWN) { > @@ -299,7 +299,7 @@ cvs_update_leavedir(struct cvs_file *cf) > if (nbytes == -1) > fatal("cvs_update_leavedir: %s", strerror(errno)); > > - xfree(buf); > + free(buf); > > prune_it: > if ((isempty == 1 && prune_dirs == 1) || > @@ -526,7 +526,7 @@ update_clear_conflict(struct cvs_file *c > > entlist = cvs_ent_open(cf->file_wd); > cvs_ent_add(entlist, entry); > - xfree(entry); > + free(entry); > } > > /* > @@ -574,7 +574,7 @@ update_has_conflict_markers(struct cvs_f > } > > cvs_freelines(lines); > - xfree(content); > + free(content); > return (conflict); > } > > @@ -717,10 +717,8 @@ out: > if (rev2 != NULL) > rcsnum_free(rev2); > > - if (jrev1 != NULL) > - xfree(jrev1); > - if (jrev2 != NULL) > - xfree(jrev2); > + free(jrev1); > + free(jrev2); > } > > void > Index: util.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/util.c,v > retrieving revision 1.157 > diff -u -p -u -r1.157 util.c > --- util.c 16 Jan 2015 06:40:07 -0000 1.157 > +++ util.c 5 Nov 2015 02:49:21 -0000 > @@ -239,11 +239,11 @@ cvs_getargv(const char *line, char **arg > if (error != 0) { > /* ditch the argument vector */ > for (i = 0; i < (u_int)argc; i++) > - xfree(argv[i]); > + free(argv[i]); > argc = -1; > } > > - xfree(linebuf); > + free(linebuf); > return (argc); > } > > @@ -284,8 +284,7 @@ cvs_freeargv(char **argv, int argc) > int i; > > for (i = 0; i < argc; i++) > - if (argv[i] != NULL) > - xfree(argv[i]); > + free(argv[i]); > } > > /* > @@ -648,14 +647,14 @@ cvs_mkpath(const char *path, char *tag) > > ent = cvs_ent_open(rpath); > cvs_ent_add(ent, entry); > - xfree(entry); > + free(entry); > > if (p != NULL) > *p = '/'; > } > } > > - xfree(dir); > + free(dir); > } > > void > @@ -696,7 +695,7 @@ cvs_mkdir(const char *path, mode_t mode) > fatal("cvs_mkdir: %s: %s", rpath, strerror(errno)); > } > > - xfree(dir); > + free(dir); > } > > /* > @@ -741,11 +740,11 @@ cvs_freelines(struct rcs_lines *lines) > while ((lp = TAILQ_FIRST(&(lines->l_lines))) != NULL) { > TAILQ_REMOVE(&(lines->l_lines), lp, l_list); > if (lp->l_needsfree == 1) > - xfree(lp->l_line); > - xfree(lp); > + free(lp->l_line); > + free(lp); > } > > - xfree(lines); > + free(lines); > } > > /* > @@ -784,9 +783,9 @@ cvs_strsplit(char *str, const char *sep) > void > cvs_argv_destroy(struct cvs_argvector *av) > { > - xfree(av->str); > - xfree(av->argv); > - xfree(av); > + free(av->str); > + free(av->argv); > + free(av); > } > > u_int > Index: worklist.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/worklist.c,v > retrieving revision 1.7 > diff -u -p -u -r1.7 worklist.c > --- worklist.c 23 Jul 2010 08:31:19 -0000 1.7 > +++ worklist.c 5 Nov 2015 02:49:21 -0000 > @@ -24,6 +24,7 @@ > * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > > +#include <stdlib.h> > #include <string.h> > #include <unistd.h> > > @@ -68,7 +69,7 @@ worklist_run(struct wklhead *list, void > > while ((wkl = SLIST_FIRST(list)) != NULL) { > SLIST_REMOVE_HEAD(list, wkl_list); > - xfree(wkl); > + free(wkl); > } > > sigprocmask(SIG_SETMASK, &old, NULL); > Index: xmalloc.c > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/xmalloc.c,v > retrieving revision 1.11 > diff -u -p -u -r1.11 xmalloc.c > --- xmalloc.c 5 Feb 2015 12:59:57 -0000 1.11 > +++ xmalloc.c 5 Nov 2015 02:49:21 -0000 > @@ -67,14 +67,6 @@ xreallocarray(void *ptr, size_t nmemb, s > return new_ptr; > } > > -void > -xfree(void *ptr) > -{ > - if (ptr == NULL) > - fatal("xfree: NULL pointer given as argument"); > - free(ptr); > -} > - > char * > xstrdup(const char *str) > { > Index: xmalloc.h > =================================================================== > RCS file: /cvs/src/usr.bin/cvs/xmalloc.h,v > retrieving revision 1.4 > diff -u -p -u -r1.4 xmalloc.h > --- xmalloc.h 1 Dec 2014 21:58:46 -0000 1.4 > +++ xmalloc.h 5 Nov 2015 02:49:21 -0000 > @@ -22,7 +22,6 @@ > void *xmalloc(size_t); > void *xcalloc(size_t, size_t); > void *xreallocarray(void *, size_t, size_t); > -void xfree(void *); > char *xstrdup(const char *); > int xasprintf(char **, const char *, ...) > __attribute__((__format__ (printf, 2, 3))) >