diff options
author | Patrick Latifi <pat@cvs.openbsd.org> | 2006-03-27 06:13:52 +0000 |
---|---|---|
committer | Patrick Latifi <pat@cvs.openbsd.org> | 2006-03-27 06:13:52 +0000 |
commit | 49f8748d61e452bb0962f8dbd1955014431e975c (patch) | |
tree | e8a3bd9cd544e09278f2904edbaa94e1ae4fab8e /usr.bin/rcs | |
parent | f918003bd62c63f053b8fe8af733ab370a6517ca (diff) |
Plug a memory leak for all cvs_strsplit call sites; ok xsa@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 18 | ||||
-rw-r--r-- | usr.bin/rcs/rlog.c | 24 |
2 files changed, 22 insertions, 20 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index 3b31242b1bc..9d162fb2622 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.85 2006/03/24 05:14:48 ray Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.86 2006/03/27 06:13:51 pat Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -612,26 +612,26 @@ rcs_main(int argc, char **argv) /* entries to add to the access list */ if (alist != NULL) { - char **aargv; + struct cvs_argvector *aargv; aargv = cvs_strsplit(alist, ","); - for (j = 0; aargv[j] != NULL; j++) - rcs_access_add(file, aargv[j]); + for (j = 0; aargv->argv[j] != NULL; j++) + rcs_access_add(file, aargv->argv[j]); - xfree(aargv); + cvs_argv_destroy(aargv); } if (comment != NULL) rcs_comment_set(file, comment); if (elist != NULL) { - char **eargv; + struct cvs_argvector *eargv; eargv = cvs_strsplit(elist, ","); - for (j = 0; eargv[j] != NULL; j++) - rcs_access_remove(file, eargv[j]); + for (j = 0; eargv->argv[j] != NULL; j++) + rcs_access_remove(file, eargv->argv[j]); - xfree(eargv); + cvs_argv_destroy(eargv); } else if (rcsflags & RCS_EFLAG) { struct rcs_access *rap; diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c index fcdea352b57..b01927cf8e2 100644 --- a/usr.bin/rcs/rlog.c +++ b/usr.bin/rcs/rlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rlog.c,v 1.33 2006/03/24 05:14:48 ray Exp $ */ +/* $OpenBSD: rlog.c,v 1.34 2006/03/27 06:13:51 pat Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -217,7 +217,7 @@ rlog_rev_print(struct rcs_delta *rdp) { int i, found; char *author, numb[64]; - char **largv, **sargv, **wargv; + struct cvs_argvector *largv, *sargv, *wargv; i = found = 0; author = NULL; @@ -236,40 +236,42 @@ rlog_rev_print(struct rcs_delta *rdp) if (rdp->rd_locker == NULL) return; largv = cvs_strsplit(llist, ","); - for (i = 0; largv[i] != NULL; i++) { - if (strcmp(rdp->rd_locker, largv[i]) == 0) { + for (i = 0; largv->argv[i] != NULL; i++) { + if (strcmp(rdp->rd_locker, largv->argv[i]) + == 0) { found++; break; } found = 0; } - xfree(largv); + cvs_argv_destroy(largv); } } /* -sstates */ if (slist != NULL) { sargv = cvs_strsplit(slist, ","); - for (i = 0; sargv[i] != NULL; i++) { - if (strcmp(rdp->rd_state, sargv[i]) == 0) { + for (i = 0; sargv->argv[i] != NULL; i++) { + if (strcmp(rdp->rd_state, sargv->argv[i]) == 0) { found++; break; } found = 0; } - xfree(sargv); + cvs_argv_destroy(sargv); } /* -w[logins] */ if (wflag == 1) { if (wlist != NULL) { wargv = cvs_strsplit(wlist, ","); - for (i = 0; wargv[i] != NULL; i++) { - if (strcmp(rdp->rd_author, wargv[i]) == 0) { + for (i = 0; wargv->argv[i] != NULL; i++) { + if (strcmp(rdp->rd_author, wargv->argv[i]) + == 0) { found++; break; } found = 0; } - xfree(wargv); + cvs_argv_destroy(wargv); } else { if ((author = getlogin()) == NULL) fatal("getlogin failed"); |