summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-05-23 14:48:05 +0000
committerpeter <peter@FreeBSD.org>1997-05-23 14:48:05 +0000
commit5ca2cb3c698b4d545ffd5e78c9865fd18302a12a (patch)
tree77e0434b4a29a2016f7287de2d73bdac43f1aeef /contrib/cvs/src
parent2f3b1873a166e82848aee73ec3720da31bc6e7d6 (diff)
parentfc35590c6dddf32e1fa855b541dc28a23965f90c (diff)
downloadFreeBSD-src-5ca2cb3c698b4d545ffd5e78c9865fd18302a12a.zip
FreeBSD-src-5ca2cb3c698b4d545ffd5e78c9865fd18302a12a.tar.gz
This commit was generated by cvs2svn to compensate for changes in r26065,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/ChangeLog36
-rw-r--r--contrib/cvs/src/add.c2
-rw-r--r--contrib/cvs/src/checkout.c2
-rw-r--r--contrib/cvs/src/commit.c2
-rw-r--r--contrib/cvs/src/cvsrc.c20
-rw-r--r--contrib/cvs/src/edit.c8
-rw-r--r--contrib/cvs/src/history.c2
-rw-r--r--contrib/cvs/src/import.c2
-rw-r--r--contrib/cvs/src/log.c2
-rw-r--r--contrib/cvs/src/logmsg.c2
-rw-r--r--contrib/cvs/src/modules.c37
-rw-r--r--contrib/cvs/src/parseinfo.c7
-rw-r--r--contrib/cvs/src/patch.c2
-rw-r--r--contrib/cvs/src/recurse.c4
-rw-r--r--contrib/cvs/src/release.c2
-rw-r--r--contrib/cvs/src/remove.c2
-rw-r--r--contrib/cvs/src/rtag.c2
-rw-r--r--contrib/cvs/src/status.c2
-rw-r--r--contrib/cvs/src/subr.c6
-rw-r--r--contrib/cvs/src/tag.c2
-rw-r--r--contrib/cvs/src/update.c2
-rw-r--r--contrib/cvs/src/watch.c4
22 files changed, 111 insertions, 39 deletions
diff --git a/contrib/cvs/src/ChangeLog b/contrib/cvs/src/ChangeLog
index e1d4dc0..5f4f43e 100644
--- a/contrib/cvs/src/ChangeLog
+++ b/contrib/cvs/src/ChangeLog
@@ -1,5 +1,41 @@
+Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * subr.c (free_names): Update documentation to reflect fact that
+ free_names is now called to free vectors allocated by expand_wild
+ as well as by line2argv.
+
+ * main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as
+ specified in HACKING.
+
+Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de>
+
+ * modules.c (do_module): initialize optind to 0. use local copies
+ of optarg's (because they might me freed within free_names).
+
Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de>
+ * main.c (main): initialize optind to 0. use local copies of
+ optarg's (because they might me freed within read_cvsrc).
+
+ * cvsrc.c (read_cvsrc): free old argv after constructing a new
+ one. This fixes a memory leak.
+
+ * recurse.c (start_recursion): use free_names() instead of
+ reimplementing it
+
+ * rcs.c (RCS_deltas): free branchversion (memory leak).
+
+ * parseinfo.c (Parse_Info): free some vars (3 memory leaks).
+
+ * logmsg.c (logfile_write): free str_list_format (memory leak).
+
+ * watch.c (watch_addremove), (watchers), update.c (update), tag.c
+ (cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove),
+ release.c (release), patch.c (patch), log.c (cvslog), import.c
+ (import), history.c (history), edit.c (watch_onoff), (edit),
+ (unedit), (editors), diff.c (diff), commit.c (commit), checkout.c
+ (checkout), add.c (add): initialize optind to 0
+
* diff.c (diff_fileproc): cosmetic change (whitespace added).
* checkout.c (checkout): move local variable definition into the
diff --git a/contrib/cvs/src/add.c b/contrib/cvs/src/add.c
index b7d5e5d..9220930 100644
--- a/contrib/cvs/src/add.c
+++ b/contrib/cvs/src/add.c
@@ -102,7 +102,7 @@ add (argc, argv)
wrap_setup ();
/* parse args */
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+k:m:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/checkout.c b/contrib/cvs/src/checkout.c
index 5074fe4..8209601 100644
--- a/contrib/cvs/src/checkout.c
+++ b/contrib/cvs/src/checkout.c
@@ -135,7 +135,7 @@ checkout (argc, argv)
ign_setup ();
wrap_setup ();
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, valid_options)) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index c0c3597..c43e35f 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -332,7 +332,7 @@ commit (argc, argv)
}
#endif /* CVS_BADROOT */
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+nlRm:fF:r:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/cvsrc.c b/contrib/cvs/src/cvsrc.c
index 819013c..5e9cfa5 100644
--- a/contrib/cvs/src/cvsrc.c
+++ b/contrib/cvs/src/cvsrc.c
@@ -51,6 +51,13 @@ read_cvsrc (argc, argv, cmdname)
int max_new_argv;
char **new_argv;
+ /* old_argc and old_argv hold the values returned from the
+ previous invocation of read_cvsrc and are used to free the
+ allocated memory. The first invocation of read_cvsrc gets argv
+ from the system, this memory must not be free'd. */
+ static int old_argc = 0;
+ static char **old_argv = NULL;
+
/* don't do anything if argc is -1, since that implies "help" mode */
if (*argc == -1)
return;
@@ -134,11 +141,18 @@ read_cvsrc (argc, argv, cmdname)
}
for (i=1; i < *argc; i++)
{
- new_argv [new_argc++] = (*argv)[i];
+ new_argv [new_argc++] = xstrdup ((*argv)[i]);
+ }
+
+ if (old_argv != NULL)
+ {
+ /* Free the memory which was allocated in the previous
+ read_cvsrc call. */
+ free_names (&old_argc, old_argv);
}
- *argc = new_argc;
- *argv = new_argv;
+ old_argc = *argc = new_argc;
+ old_argv = *argv = new_argv;
free (homeinit);
return;
diff --git a/contrib/cvs/src/edit.c b/contrib/cvs/src/edit.c
index 8d3bbb1..33e9c61 100644
--- a/contrib/cvs/src/edit.c
+++ b/contrib/cvs/src/edit.c
@@ -60,7 +60,7 @@ watch_onoff (argc, argv)
int local = 0;
int err;
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
@@ -356,7 +356,7 @@ edit (argc, argv)
setting_tedit = 0;
setting_tunedit = 0;
setting_tcommit = 0;
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lRa:")) != -1)
{
switch (c)
@@ -491,7 +491,7 @@ unedit (argc, argv)
if (argc == -1)
usage (edit_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
@@ -983,7 +983,7 @@ editors (argc, argv)
if (argc == -1)
usage (editors_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/history.c b/contrib/cvs/src/history.c
index 7d28e81..ae13409 100644
--- a/contrib/cvs/src/history.c
+++ b/contrib/cvs/src/history.c
@@ -395,7 +395,7 @@ history (argc, argv)
since_tag = xstrdup ("");
backto = xstrdup ("");
rec_types = xstrdup ("");
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/import.c b/contrib/cvs/src/import.c
index a37bd4d..c05fa0d 100644
--- a/contrib/cvs/src/import.c
+++ b/contrib/cvs/src/import.c
@@ -80,7 +80,7 @@ import (argc, argv)
wrap_setup ();
vbranch = xstrdup (CVSBRANCH);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+Qqdb:m:I:k:W:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/log.c b/contrib/cvs/src/log.c
index 8fb6910..3fd37d4 100644
--- a/contrib/cvs/src/log.c
+++ b/contrib/cvs/src/log.c
@@ -167,7 +167,7 @@ cvslog (argc, argv)
memset (&log_data, 0, sizeof log_data);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+bd:hlNRr::s:tw::")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c
index 98e4ae1..2655fd9 100644
--- a/contrib/cvs/src/logmsg.c
+++ b/contrib/cvs/src/logmsg.c
@@ -771,6 +771,8 @@ logfile_write (repository, filter, message, logfp, changes)
(void) walklist (changes, title_proc, NULL);
}
+ free (str_list_format);
+
/* Construct the final string. */
srepos = Short_Repository (repository);
diff --git a/contrib/cvs/src/modules.c b/contrib/cvs/src/modules.c
index 7c3d495..e01f733 100644
--- a/contrib/cvs/src/modules.c
+++ b/contrib/cvs/src/modules.c
@@ -445,7 +445,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
modargv = xmodargv;
/* parse the args */
- optind = 1;
+ optind = 0;
while ((c = getopt (modargc, modargv, CVSMODULE_OPTS)) != -1)
{
switch (c)
@@ -461,7 +461,9 @@ do_module (db, mname, m_type, msg, callback_proc, where,
break;
case 'i':
nonalias_opt = 1;
- checkin_prog = optarg;
+ if (checkin_prog)
+ free (checkin_prog);
+ checkin_prog = xstrdup (optarg);
break;
case 'l':
nonalias_opt = 1;
@@ -469,19 +471,27 @@ do_module (db, mname, m_type, msg, callback_proc, where,
break;
case 'o':
nonalias_opt = 1;
- checkout_prog = optarg;
+ if (checkout_prog)
+ free (checkout_prog);
+ checkout_prog = xstrdup (optarg);
break;
case 'e':
nonalias_opt = 1;
- export_prog = optarg;
+ if (export_prog)
+ free (export_prog);
+ export_prog = xstrdup (optarg);
break;
case 't':
nonalias_opt = 1;
- tag_prog = optarg;
+ if (tag_prog)
+ free (tag_prog);
+ tag_prog = xstrdup (optarg);
break;
case 'u':
nonalias_opt = 1;
- update_prog = optarg;
+ if (update_prog)
+ free (update_prog);
+ update_prog = xstrdup (optarg);
break;
case '?':
error (0, 0,
@@ -535,12 +545,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
err += callback_proc (&modargc, modargv, where, mwhere, mfile, shorten,
local_specified, mname, msg);
-#if 0
- /* FIXME: I've fixed this so that the correct arguments are called,
- but now this fails because there is code below this point that
- uses optarg values extracted from the arg vector. */
free_names (&xmodargc, xmodargv);
-#endif
/* if there were special include args, process them now */
@@ -718,6 +723,16 @@ do_module (db, mname, m_type, msg, callback_proc, where,
/* clean up */
if (mwhere)
free (mwhere);
+ if (checkin_prog)
+ free (checkin_prog);
+ if (checkout_prog)
+ free (checkout_prog);
+ if (export_prog)
+ free (export_prog);
+ if (tag_prog)
+ free (tag_prog);
+ if (update_prog)
+ free (update_prog);
if (cwd_saved)
free_cwd (&cwd);
if (zvalue != NULL)
diff --git a/contrib/cvs/src/parseinfo.c b/contrib/cvs/src/parseinfo.c
index 1011965..833463a 100644
--- a/contrib/cvs/src/parseinfo.c
+++ b/contrib/cvs/src/parseinfo.c
@@ -54,6 +54,7 @@ Parse_Info (infofile, repository, callproc, all)
/* If no file, don't do anything special. */
if (!existence_error (errno))
error (0, errno, "cannot open %s", infopath);
+ free (infopath);
return 0;
}
@@ -105,6 +106,8 @@ Parse_Info (infofile, repository, callproc, all)
if ((cp = strrchr (value, '\n')) != NULL)
*cp = '\0';
+ if (expanded_value != NULL)
+ free (expanded_value);
expanded_value = expand_path (value, infofile, line_number);
if (!expanded_value)
{
@@ -121,6 +124,10 @@ Parse_Info (infofile, repository, callproc, all)
/* save the default value so we have it later if we need it */
if (strcmp (exp, "DEFAULT") == 0)
{
+ /* Is it OK to silently ignore all but the last DEFAULT
+ expression? */
+ if (default_value != NULL)
+ free (default_value);
default_value = xstrdup (expanded_value);
continue;
}
diff --git a/contrib/cvs/src/patch.c b/contrib/cvs/src/patch.c
index 4c21943..1cf8397 100644
--- a/contrib/cvs/src/patch.c
+++ b/contrib/cvs/src/patch.c
@@ -70,7 +70,7 @@ patch (argc, argv)
if (argc == -1)
usage (patch_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+V:k:cuftsQqlRD:r:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/recurse.c b/contrib/cvs/src/recurse.c
index e18d576..b4b55a8 100644
--- a/contrib/cvs/src/recurse.c
+++ b/contrib/cvs/src/recurse.c
@@ -286,9 +286,7 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
err += do_recursion (&frame);
/* Free the data which expand_wild allocated. */
- for (i = 0; i < argc; ++i)
- free (argv[i]);
- free (argv);
+ free_names (&argc, argv);
out:
free (update_dir);
diff --git a/contrib/cvs/src/release.c b/contrib/cvs/src/release.c
index f2f1edf..702e903 100644
--- a/contrib/cvs/src/release.c
+++ b/contrib/cvs/src/release.c
@@ -81,7 +81,7 @@ release (argc, argv)
/* Everything from here on is client or local. */
if (argc == -1)
usage (release_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+Qdq")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/remove.c b/contrib/cvs/src/remove.c
index 1571250..46c4169 100644
--- a/contrib/cvs/src/remove.c
+++ b/contrib/cvs/src/remove.c
@@ -50,7 +50,7 @@ cvsremove (argc, argv)
if (argc == -1)
usage (remove_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+flR")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/rtag.c b/contrib/cvs/src/rtag.c
index 1e2017b..934cd40 100644
--- a/contrib/cvs/src/rtag.c
+++ b/contrib/cvs/src/rtag.c
@@ -91,7 +91,7 @@ rtag (argc, argv)
if (argc == -1)
usage (rtag_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+FanfQqlRdbr:D:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/status.c b/contrib/cvs/src/status.c
index 67b71be..cdc0949 100644
--- a/contrib/cvs/src/status.c
+++ b/contrib/cvs/src/status.c
@@ -40,7 +40,7 @@ status (argc, argv)
if (argc == -1)
usage (status_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+vlR")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/subr.c b/contrib/cvs/src/subr.c
index 6a88849..a098123 100644
--- a/contrib/cvs/src/subr.c
+++ b/contrib/cvs/src/subr.c
@@ -163,9 +163,9 @@ pathname_levels (path)
}
-/*
- * Recover the space allocated by line2argv()
- */
+/* Free a vector, where (*ARGV)[0], (*ARGV)[1], ... (*ARGV)[*PARGC - 1]
+ are malloc'd and so is *ARGV itself. Such a vector is allocated by
+ line2argv or expand_wild, for example. */
void
free_names (pargc, argv)
int *pargc;
diff --git a/contrib/cvs/src/tag.c b/contrib/cvs/src/tag.c
index 9c49da5..93e6c67 100644
--- a/contrib/cvs/src/tag.c
+++ b/contrib/cvs/src/tag.c
@@ -82,7 +82,7 @@ cvstag (argc, argv)
if (argc == -1)
usage (tag_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+FQqlRcdr:D:bf")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c
index 4b7022a..1956c6f 100644
--- a/contrib/cvs/src/update.c
+++ b/contrib/cvs/src/update.c
@@ -135,7 +135,7 @@ update (argc, argv)
wrap_setup ();
/* parse the args */
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+ApPflRQqduk:r:D:j:I:W:")) != -1)
{
switch (c)
diff --git a/contrib/cvs/src/watch.c b/contrib/cvs/src/watch.c
index 9bb50d0..6cec157 100644
--- a/contrib/cvs/src/watch.c
+++ b/contrib/cvs/src/watch.c
@@ -256,7 +256,7 @@ watch_addremove (argc, argv)
the_args.commit = 0;
the_args.edit = 0;
the_args.unedit = 0;
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lRa:")) != -1)
{
switch (c)
@@ -485,7 +485,7 @@ watchers (argc, argv)
if (argc == -1)
usage (watchers_usage);
- optind = 1;
+ optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
OpenPOWER on IntegriCloud