Date: Sun, 11 Sep 2016 16:20:57 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r305697 - vendor/OpenBSD/dist/usr.bin/rcs Message-ID: <201609111620.u8BGKvbi061672@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sun Sep 11 16:20:57 2016 New Revision: 305697 URL: https://svnweb.freebsd.org/changeset/base/305697 Log: Revert r305694: This has some changes that we have no interest in. This is only for reference but we will have to chose a different snapshot. Modified: vendor/OpenBSD/dist/usr.bin/rcs/buf.c vendor/OpenBSD/dist/usr.bin/rcs/ci.c vendor/OpenBSD/dist/usr.bin/rcs/co.c vendor/OpenBSD/dist/usr.bin/rcs/date.y vendor/OpenBSD/dist/usr.bin/rcs/diff.c vendor/OpenBSD/dist/usr.bin/rcs/diff3.c vendor/OpenBSD/dist/usr.bin/rcs/ident.c vendor/OpenBSD/dist/usr.bin/rcs/merge.c vendor/OpenBSD/dist/usr.bin/rcs/rcs.1 vendor/OpenBSD/dist/usr.bin/rcs/rcs.c vendor/OpenBSD/dist/usr.bin/rcs/rcs.h vendor/OpenBSD/dist/usr.bin/rcs/rcsclean.c vendor/OpenBSD/dist/usr.bin/rcs/rcsdiff.c vendor/OpenBSD/dist/usr.bin/rcs/rcsmerge.c vendor/OpenBSD/dist/usr.bin/rcs/rcsnum.c vendor/OpenBSD/dist/usr.bin/rcs/rcsparse.c vendor/OpenBSD/dist/usr.bin/rcs/rcsprog.c vendor/OpenBSD/dist/usr.bin/rcs/rcstime.c vendor/OpenBSD/dist/usr.bin/rcs/rcsutil.c vendor/OpenBSD/dist/usr.bin/rcs/rcsutil.h vendor/OpenBSD/dist/usr.bin/rcs/rlog.1 vendor/OpenBSD/dist/usr.bin/rcs/rlog.c vendor/OpenBSD/dist/usr.bin/rcs/worklist.c vendor/OpenBSD/dist/usr.bin/rcs/xmalloc.c vendor/OpenBSD/dist/usr.bin/rcs/xmalloc.h Modified: vendor/OpenBSD/dist/usr.bin/rcs/buf.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/buf.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/buf.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.26 2015/11/02 16:45:21 nicm Exp $ */ +/* $OpenBSD: buf.c,v 1.24 2015/02/05 12:59:58 millert Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -32,7 +32,6 @@ #include <fcntl.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -138,16 +137,15 @@ out: void buf_free(BUF *b) { - if (b == NULL) - return; - free(b->cb_buf); - free(b); + if (b->cb_buf != NULL) + xfree(b->cb_buf); + xfree(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 - * free(). + * xfree(). */ void * buf_release(BUF *b) @@ -155,7 +153,7 @@ buf_release(BUF *b) void *tmp; tmp = b->cb_buf; - free(b); + xfree(b); return (tmp); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/ci.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/ci.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/ci.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.224 2016/07/04 01:39:12 millert Exp $ */ +/* $OpenBSD: ci.c,v 1.219 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -210,7 +210,8 @@ checkin_main(int argc, char **argv) printf("%s\n", rcs_version); exit(0); case 'w': - free(pb.author); + if (pb.author != NULL) + xfree(pb.author); pb.author = xstrdup(rcs_optarg); break; case 'x': @@ -279,7 +280,7 @@ checkin_main(int argc, char **argv) errx(1, "failed to open rcsfile `%s'", pb.fpath); if ((pb.flags & DESCRIPTION) && - rcs_set_description(pb.file, pb.description, pb.flags) == -1) + rcs_set_description(pb.file, pb.description) == -1) err(1, "%s", pb.filename); if (!(pb.flags & QUIET)) @@ -369,11 +370,16 @@ checkin_diff_file(struct checkin_params return (b3); out: - buf_free(b1); - buf_free(b2); - buf_free(b3); - free(path1); - free(path2); + if (b1 != NULL) + buf_free(b1); + if (b2 != NULL) + buf_free(b2); + if (b3 != NULL) + buf_free(b3); + if (path1 != NULL) + xfree(path1); + if (path2 != NULL) + xfree(path2); return (NULL); } @@ -406,7 +412,7 @@ checkin_getlogmsg(RCSNUM *rev, RCSNUM *r (void)fprintf(stderr, "new revision: %s; " "previous revision: %s\n", nrev, prev); - rcs_msg = rcs_prompt(prompt, flags); + rcs_msg = rcs_prompt(prompt); return (rcs_msg); } @@ -505,7 +511,7 @@ checkin_update(struct checkin_params *pb fprintf(stderr, "reuse log message of previous file? [yn](y): "); if (rcs_yesno('y') != 'y') { - free(pb->rcs_msg); + xfree(pb->rcs_msg); pb->rcs_msg = NULL; } } @@ -578,7 +584,7 @@ checkin_update(struct checkin_params *pb pb->username, pb->author, NULL, NULL); if ((pb->flags & INTERACTIVE) && (pb->rcs_msg[0] == '\0')) { - free(pb->rcs_msg); /* free empty log message */ + xfree(pb->rcs_msg); /* free empty log message */ pb->rcs_msg = NULL; } @@ -621,7 +627,7 @@ checkin_init(struct checkin_params *pb) /* Get description from user */ if (pb->description == NULL && - rcs_set_description(pb->file, NULL, pb->flags) == -1) { + rcs_set_description(pb->file, NULL) == -1) { warn("%s", pb->filename); return (-1); } @@ -728,7 +734,7 @@ checkin_attach_symbol(struct checkin_par } } } - if ((ret = rcs_sym_add(pb->file, pb->symbol, pb->newrev)) == -1 && + if ((ret = rcs_sym_add(pb->file, pb->symbol, pb->newrev) == -1) && (rcs_errno == RCS_ERR_DUPENT)) { rcsnum_tostr(rcs_sym_getrev(pb->file, pb->symbol), rbuf, sizeof(rbuf)); @@ -982,22 +988,25 @@ checkin_parsekeyword(char *keystring, RC (void)xasprintf(&datestring, "%s %s", tokens[3], tokens[4]); if ((*date = date_parse(datestring)) == -1) errx(1, "could not parse date"); - free(datestring); + xfree(datestring); if (i < 6) break; - free(*author); + if (*author != NULL) + xfree(*author); *author = xstrdup(tokens[5]); if (i < 7) break; - free(*state); + if (*state != NULL) + xfree(*state); *state = xstrdup(tokens[6]); break; case KW_TYPE_AUTHOR: if (i < 2) break; - free(*author); + if (*author != NULL) + xfree(*author); *author = xstrdup(tokens[1]); break; case KW_TYPE_DATE: @@ -1006,12 +1015,13 @@ checkin_parsekeyword(char *keystring, RC (void)xasprintf(&datestring, "%s %s", tokens[1], tokens[2]); if ((*date = date_parse(datestring)) == -1) errx(1, "could not parse date"); - free(datestring); + xfree(datestring); break; case KW_TYPE_STATE: if (i < 2) break; - free(*state); + if (*state != NULL) + xfree(*state); *state = xstrdup(tokens[1]); break; case KW_TYPE_REVISION: Modified: vendor/OpenBSD/dist/usr.bin/rcs/co.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/co.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/co.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: co.c,v 1.122 2015/10/21 16:06:57 millert Exp $ */ +/* $OpenBSD: co.c,v 1.120 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -515,7 +515,7 @@ checkout_err_nobranch(RCSFILE *file, con file->rf_path, date ? " a date before " : "", date ? date : "", - author ? " and author " + (date ? 0:4) : "", + author ? " and author " + (date ? 0:4 ) : "", author ? author : "", state ? " and state " + (date || author ? 0:4) : "", state ? state : ""); @@ -554,7 +554,7 @@ checkout_file_has_diffs(RCSFILE *rfp, RC buf_free(bp); unlink(tempfile); - free(tempfile); + xfree(tempfile); return (ret); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/date.y ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/date.y Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/date.y Sun Sep 11 16:20:57 2016 (r305697) @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: date.y,v 1.14 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: date.y,v 1.12 2013/12/03 00:21:49 deraadt Exp $ */ /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while @@ -17,7 +17,6 @@ #include <ctype.h> #include <err.h> #include <string.h> -#include <time.h> #include "rcsprog.h" @@ -495,7 +494,7 @@ yyerror(const char *s) s, yyInput); warnx("%s", str); - free(str); + xfree(str); return (0); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/diff.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/diff.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/diff.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.38 2015/06/13 20:15:21 nicm Exp $ */ +/* $OpenBSD: diff.c,v 1.37 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -72,7 +72,6 @@ #include <stdint.h> #include <stddef.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> #include <limits.h> @@ -375,13 +374,13 @@ diffreg(const char *file1, const char *f clistlen = 100; clist = xcalloc(clistlen, sizeof(*clist)); i = stone(class, slen[0], member, klist, flags); - free(member); - free(class); + xfree(member); + xfree(class); J = xreallocarray(J, len[0] + 2, sizeof(*J)); unravel(klist[i]); - free(clist); - free(klist); + xfree(clist); + xfree(klist); ixold = xreallocarray(ixold, len[0] + 2, sizeof(*ixold)); ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew)); @@ -770,7 +769,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]; - free(a); + xfree(a); } static int @@ -861,7 +860,7 @@ ignoreline(char *line) int ret; ret = regexec(diff_ignore_re, line, 0, NULL, 0); - free(line); + xfree(line); return (ret == 0); /* if it matched, it should be ignored. */ } @@ -1384,5 +1383,5 @@ diff_output(const char *fmt, ...) buf_append(diffbuf, str, strlen(str)); else printf("%s", str); - free(str); + xfree(str); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/diff3.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/diff3.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/diff3.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.39 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: diff3.c,v 1.35 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -69,7 +69,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> #include <unistd.h> #include "diff.h" @@ -235,10 +234,14 @@ merge_diff3(char **av, int flags) warnx("warning: overlaps or other problems during merge"); out: - buf_free(b2); - buf_free(b3); - buf_free(d1); - buf_free(d2); + if (b2 != NULL) + buf_free(b2); + if (b3 != NULL) + buf_free(b3); + if (d1 != NULL) + buf_free(d1); + if (d2 != NULL) + buf_free(d2); (void)unlink(path1); (void)unlink(path2); @@ -246,13 +249,20 @@ out: (void)unlink(dp13); (void)unlink(dp23); - free(path1); - free(path2); - free(path3); - free(dp13); - free(dp23); - free(data); - free(patch); + if (path1 != NULL) + xfree(path1); + if (path2 != NULL) + xfree(path2); + if (path3 != NULL) + xfree(path3); + if (dp13 != NULL) + xfree(dp13); + if (dp23 != NULL) + xfree(dp23); + if (data != NULL) + xfree(data); + if (patch != NULL) + xfree(patch); return (diffb); } @@ -351,10 +361,14 @@ rcs_diff3(RCSFILE *rf, char *workfile, R warnx("warning: overlaps or other problems during merge"); out: - buf_free(b2); - buf_free(b3); - buf_free(d1); - buf_free(d2); + if (b2 != NULL) + buf_free(b2); + if (b3 != NULL) + buf_free(b3); + if (d1 != NULL) + buf_free(d1); + if (d2 != NULL) + buf_free(d2); (void)unlink(path1); (void)unlink(path2); @@ -362,13 +376,20 @@ out: (void)unlink(dp13); (void)unlink(dp23); - free(path1); - free(path2); - free(path3); - free(dp13); - free(dp23); - free(data); - free(patch); + if (path1 != NULL) + xfree(path1); + if (path2 != NULL) + xfree(path2); + if (path3 != NULL) + xfree(path3); + if (dp13 != NULL) + xfree(dp13); + if (dp23 != NULL) + xfree(dp23); + if (data != NULL) + xfree(data); + if (patch != NULL) + xfree(patch); return (diffb); } @@ -636,7 +657,7 @@ merge(size_t m1, size_t m2) d1 = d13; d2 = d23; j = 0; - while ((t1 = (d1 < d13 + m1)) | (t2 = (d2 < d23 + m2))) { + while ((t1 = d1 < d13 + m1) | (t2 = d2 < d23 + m2)) { if (debug) { printf("%d,%d=%d,%d %d,%d=%d,%d\n", d1->old.from, d1->old.to, Modified: vendor/OpenBSD/dist/usr.bin/rcs/ident.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/ident.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/ident.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: ident.c,v 1.32 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: ident.c,v 1.30 2014/10/02 06:23:15 otto Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -28,7 +28,6 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <time.h> #include <unistd.h> #include "rcsprog.h" @@ -157,7 +156,8 @@ ident_line(FILE *fp) found++; out: - buf_free(bp); + if (bp != NULL) + buf_free(bp); } __dead void Modified: vendor/OpenBSD/dist/usr.bin/rcs/merge.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/merge.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/merge.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: merge.c,v 1.10 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: merge.c,v 1.9 2014/10/10 08:15:25 otto Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -27,7 +27,6 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <time.h> #include <unistd.h> #include "rcsprog.h" Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcs.1 ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcs.1 Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcs.1 Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -.\" $OpenBSD: rcs.1,v 1.59 2015/09/25 15:31:24 schwarze Exp $ +.\" $OpenBSD: rcs.1,v 1.58 2013/01/18 11:21:09 guenther Exp $ .\" .\" Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> .\" Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> @@ -24,7 +24,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: September 25 2015 $ +.Dd $Mdocdate: January 18 2013 $ .Dt RCS 1 .Os .Sh NAME @@ -40,7 +40,8 @@ .Op Fl e Ns Op Ar users .Op Fl k Ns Ar mode .Op Fl l Ns Op Ar rev -.Op Fl m Ns Ar rev : Ns Ar msg +.Oo Fl m Ns Ar rev : +.Ar msg Oc .Op Fl o Ns Ar rev .Op Fl t Ns Op Ar str .Op Fl u Ns Op Ar rev Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcs.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcs.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcs.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.85 2016/05/09 13:03:55 schwarze Exp $ */ +/* $OpenBSD: rcs.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -66,7 +66,6 @@ struct rcs_kw rcs_expkw[] = { { "Revision", RCS_KW_REVISION }, { "Source", RCS_KW_SOURCE }, { "State", RCS_KW_STATE }, - { "Mdocdate", RCS_KW_MDOCDATE }, }; int rcs_errno = RCS_ERR_NOERR; @@ -158,40 +157,44 @@ rcs_close(RCSFILE *rfp) while (!TAILQ_EMPTY(&(rfp->rf_access))) { rap = TAILQ_FIRST(&(rfp->rf_access)); TAILQ_REMOVE(&(rfp->rf_access), rap, ra_list); - free(rap->ra_name); - free(rap); + xfree(rap->ra_name); + xfree(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); - free(rsp->rs_name); - free(rsp); + xfree(rsp->rs_name); + xfree(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); - free(rlp->rl_name); - free(rlp); + xfree(rlp->rl_name); + xfree(rlp); } - rcsnum_free(rfp->rf_head); - rcsnum_free(rfp->rf_branch); + if (rfp->rf_head != NULL) + rcsnum_free(rfp->rf_head); + if (rfp->rf_branch != NULL) + rcsnum_free(rfp->rf_branch); if (rfp->rf_file != NULL) fclose(rfp->rf_file); - - free(rfp->rf_path); - free(rfp->rf_comment); - free(rfp->rf_expand); - free(rfp->rf_desc); + 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); if (rfp->rf_pdata != NULL) rcsparse_free(rfp); - - free(rfp); + xfree(rfp); } /* @@ -346,7 +349,8 @@ rcs_write(RCSFILE *rfp) rfp->rf_flags |= RCS_SYNCED; - free(fn); + if (fn != NULL) + xfree(fn); } /* @@ -416,7 +420,7 @@ rcs_movefile(char *from, char *to, mode_ out: (void)fclose(src); (void)fclose(dst); - free(buf); + xfree(buf); return (0); } @@ -505,8 +509,8 @@ rcs_access_remove(RCSFILE *file, const c } TAILQ_REMOVE(&(file->rf_access), ap, ra_list); - free(ap->ra_name); - free(ap); + xfree(ap->ra_name); + xfree(ap); /* not synced anymore */ file->rf_flags &= ~RCS_SYNCED; @@ -578,9 +582,9 @@ rcs_sym_remove(RCSFILE *file, const char } TAILQ_REMOVE(&(file->rf_symbols), symp, rs_list); - free(symp->rs_name); + xfree(symp->rs_name); rcsnum_free(symp->rs_num); - free(symp); + xfree(symp); /* not synced anymore */ file->rf_flags &= ~RCS_SYNCED; @@ -739,8 +743,8 @@ rcs_lock_remove(RCSFILE *file, const cha TAILQ_REMOVE(&(file->rf_locks), lkp, rl_list); rcsnum_free(lkp->rl_num); - free(lkp->rl_name); - free(lkp); + xfree(lkp->rl_name); + xfree(lkp); /* not synced anymore */ file->rf_flags &= ~RCS_SYNCED; @@ -758,7 +762,8 @@ rcs_desc_set(RCSFILE *file, const char * char *tmp; tmp = xstrdup(desc); - free(file->rf_desc); + if (file->rf_desc != NULL) + xfree(file->rf_desc); file->rf_desc = tmp; file->rf_flags &= ~RCS_SYNCED; } @@ -774,7 +779,8 @@ rcs_comment_set(RCSFILE *file, const cha char *tmp; tmp = xstrdup(comment); - free(file->rf_comment); + if (file->rf_comment != NULL) + xfree(file->rf_comment); file->rf_comment = tmp; file->rf_flags &= ~RCS_SYNCED; } @@ -833,7 +839,7 @@ rcs_patch_lines(struct rcs_lines *dlines for (i = 0; (i < nbln) && (dlp != NULL); i++) { ndlp = TAILQ_NEXT(dlp, l_list); TAILQ_REMOVE(&(dlines->l_lines), dlp, l_list); - free(dlp); + xfree(dlp); dlp = ndlp; /* last line is gone - reset dlp */ if (dlp == NULL) { @@ -1014,7 +1020,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) return (NULL); rbuf = rcs_patchfile(data, dlen, patch, plen, rcs_patch_lines); - free(data); + xfree(data); if (rbuf == NULL) break; @@ -1240,8 +1246,10 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) rcs_freedelta(rdp); - free(path_tmp1); - free(path_tmp2); + if (path_tmp1 != NULL) + xfree(path_tmp1); + if (path_tmp2 != NULL) + xfree(path_tmp2); return (0); } @@ -1335,7 +1343,8 @@ rcs_kwexp_set(RCSFILE *file, int mode) } tmp = xstrdup(buf); - free(file->rf_expand); + if (file->rf_expand != NULL) + xfree(file->rf_expand); file->rf_expand = tmp; /* not synced anymore */ file->rf_flags &= ~RCS_SYNCED; @@ -1405,22 +1414,29 @@ rcs_freedelta(struct rcs_delta *rdp) { struct rcs_branch *rb; - rcsnum_free(rdp->rd_num); - rcsnum_free(rdp->rd_next); - - free(rdp->rd_author); - free(rdp->rd_locker); - free(rdp->rd_state); - free(rdp->rd_log); - free(rdp->rd_text); + if (rdp->rd_num != NULL) + rcsnum_free(rdp->rd_num); + 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); while ((rb = TAILQ_FIRST(&(rdp->rd_branches))) != NULL) { TAILQ_REMOVE(&(rdp->rd_branches), rb, rb_list); rcsnum_free(rb->rb_num); - free(rb); + xfree(rb); } - free(rdp); + xfree(rdp); } /* @@ -1597,16 +1613,6 @@ rcs_expand_keywords(char *rcsfile_in, st buf_putc(newbuf, ' '); } - if (kwtype & RCS_KW_MDOCDATE) { - strftime(buf, sizeof(buf), "%B", &tb); - buf_puts(newbuf, buf); - /* Only one blank before single-digit day. */ - snprintf(buf, sizeof(buf), " %d", tb.tm_mday); - buf_puts(newbuf, buf); - strftime(buf, sizeof(buf), " %Y ", &tb); - buf_puts(newbuf, buf); - } - if (kwtype & RCS_KW_NAME) buf_putc(newbuf, ' '); @@ -1695,7 +1701,8 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM * if ((rdp = rcs_findrev(rfp, rev)) == NULL) return (-1); - free(rdp->rd_text); + if (rdp->rd_text != NULL) + xfree(rdp->rd_text); len = buf_len(bp); dtext = buf_release(bp); @@ -1710,7 +1717,8 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM * rdp->rd_tlen = 0; } - free(dtext); + if (dtext != NULL) + xfree(dtext); return (0); } @@ -1728,7 +1736,8 @@ rcs_rev_setlog(RCSFILE *rfp, RCSNUM *rev if ((rdp = rcs_findrev(rfp, rev)) == NULL) return (-1); - free(rdp->rd_log); + if (rdp->rd_log != NULL) + xfree(rdp->rd_log); rdp->rd_log = xstrdup(logtext); rfp->rf_flags &= ~RCS_SYNCED; @@ -1767,7 +1776,8 @@ rcs_state_set(RCSFILE *rfp, RCSNUM *rev, if ((rdp = rcs_findrev(rfp, rev)) == NULL) return (-1); - free(rdp->rd_state); + if (rdp->rd_state != NULL) + xfree(rdp->rd_state); rdp->rd_state = xstrdup(state); Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcs.h ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcs.h Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcs.h Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.17 2016/05/09 13:03:55 schwarze Exp $ */ +/* $OpenBSD: rcs.h,v 1.16 2013/06/03 17:04:35 jcs Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -69,7 +69,6 @@ #define RCS_KW_SOURCE 0x0400 #define RCS_KW_STATE 0x0800 #define RCS_KW_FULLPATH 0x0010 -#define RCS_KW_MDOCDATE 0x0020 #define RCS_KW_LOCKER 0x10000 #define RCS_KW_ID \ Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcsclean.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcsclean.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcsclean.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsclean.c,v 1.56 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: rcsclean.c,v 1.54 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -30,7 +30,6 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <time.h> #include <unistd.h> #include "rcsprog.h" @@ -210,8 +209,10 @@ rcsclean_file(char *fname, const char *r rcs_set_mtime(file, rcs_mtime); out: - buf_free(b1); - buf_free(b2); + if (b1 != NULL) + buf_free(b1); + if (b2 != NULL) + buf_free(b2); if (file != NULL) rcs_close(file); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcsdiff.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcsdiff.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcsdiff.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.84 2015/11/02 16:45:21 nicm Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -250,9 +250,15 @@ rcsdiff_main(int argc, char **argv) status = rcsdiff_rev(file, rev1, rev2, dflags); rcs_close(file); - rcsnum_free(rev1); - rcsnum_free(rev2); - rev1 = rev2 = NULL; + + if (rev1 != NULL) { + rcsnum_free(rev1); + rev1 = NULL; + } + if (rev2 != NULL) { + rcsnum_free(rev2); + rev2 = NULL; + } } return (status); @@ -348,10 +354,14 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, out: if (fd != -1) (void)close(fd); - buf_free(b1); - buf_free(b2); - free(path1); - free(path2); + if (b1 != NULL) + buf_free(b1); + if (b2 != NULL) + buf_free(b2); + if (path1 != NULL) + xfree(path1); + if (path2 != NULL) + xfree(path2); return (ret); } @@ -423,10 +433,14 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, ret = diffreg(path1, path2, NULL, dflags); out: - buf_free(b1); - buf_free(b2); - free(path1); - free(path2); + if (b1 != NULL) + buf_free(b1); + if (b2 != NULL) + buf_free(b2); + if (path1 != NULL) + xfree(path1); + if (path2 != NULL) + xfree(path2); return (ret); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcsmerge.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcsmerge.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcsmerge.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsmerge.c,v 1.57 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: rcsmerge.c,v 1.55 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -28,7 +28,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> #include <unistd.h> #include "rcsprog.h" @@ -174,8 +173,12 @@ rcsmerge_main(int argc, char **argv) out: rcs_close(file); - rcsnum_free(rev1); - rcsnum_free(rev2); + + if (rev1 != NULL) + rcsnum_free(rev1); + if (rev2 != NULL) + rcsnum_free(rev2); + return (status); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcsnum.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcsnum.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcsnum.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.19 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.16 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -26,10 +26,8 @@ #include <ctype.h> #include <err.h> -#include <limits.h> -#include <stdlib.h> #include <string.h> -#include <time.h> +#include <limits.h> #include "rcs.h" #include "xmalloc.h" @@ -106,10 +104,9 @@ rcsnum_parse(const char *str) void rcsnum_free(RCSNUM *rn) { - if (rn == NULL) - return; - free(rn->rn_id); - free(rn); + if (rn->rn_id != NULL) + xfree(rn->rn_id); + xfree(rn); } /* @@ -334,7 +331,7 @@ rcsnum_aton(const char *str, char **ep, rcsnum_aton_failed: nump->rn_len = 0; - free(nump->rn_id); + xfree(nump->rn_id); nump->rn_id = NULL; return (-1); } Modified: vendor/OpenBSD/dist/usr.bin/rcs/rcsparse.c ============================================================================== --- vendor/OpenBSD/dist/usr.bin/rcs/rcsparse.c Sun Sep 11 16:11:51 2016 (r305696) +++ vendor/OpenBSD/dist/usr.bin/rcs/rcsparse.c Sun Sep 11 16:20:57 2016 (r305697) @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsparse.c,v 1.16 2016/08/26 09:02:54 guenther Exp $ */ +/* $OpenBSD: rcsparse.c,v 1.14 2014/12/01 21:58:46 deraadt Exp $ */ /* * Copyright (c) 2010 Tobias Stoeckmann <tobias@openbsd.org> * @@ -24,7 +24,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> #include <unistd.h> #include "rcs.h" @@ -341,10 +340,11 @@ rcsparse_free(RCSFILE *rfp) pdp = rfp->rf_pdata; - free(pdp->rp_buf); + if (pdp->rp_buf != NULL) + xfree(pdp->rp_buf); if (pdp->rp_token == RCS_TYPE_REVISION) rcsnum_free(pdp->rp_value.rev); - free(pdp); + xfree(pdp); } /* @@ -609,7 +609,7 @@ rcsparse_text(RCSFILE *rfp, struct rcs_p memcpy(pdp->rp_delta->rd_text, pdp->rp_buf, pdp->rp_delta->rd_tlen); } - free(pdp->rp_value.str); + xfree(pdp->rp_value.str); return (0); } @@ -707,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) { - free(name); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609111620.u8BGKvbi061672>