|
|
e6eb8e |
diff --git a/builtins/fc.def b/builtins/fc.def
|
|
|
e6eb8e |
index fe16471..98c53db 100644
|
|
|
e6eb8e |
--- a/builtins/fc.def
|
|
|
e6eb8e |
+++ b/builtins/fc.def
|
|
|
e6eb8e |
@@ -423,6 +423,7 @@ fc_builtin (list)
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
sh_wrerror ();
|
|
|
e6eb8e |
fclose (stream);
|
|
|
e6eb8e |
+ FREE (fn);
|
|
|
e6eb8e |
return (EXECUTION_FAILURE);
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
fclose (stream);
|
|
|
e6eb8e |
diff --git a/execute_cmd.c b/execute_cmd.c
|
|
|
e6eb8e |
index 63a332a..15b5e19 100644
|
|
|
e6eb8e |
--- a/execute_cmd.c
|
|
|
e6eb8e |
+++ b/execute_cmd.c
|
|
|
e6eb8e |
@@ -2196,8 +2196,10 @@ coproc_setvars (cp)
|
|
|
e6eb8e |
if (v == 0)
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
v = find_variable_nameref_for_create (cp->c_name, 1);
|
|
|
e6eb8e |
- if (v == INVALID_NAMEREF_VALUE)
|
|
|
e6eb8e |
- return;
|
|
|
e6eb8e |
+ if (v == INVALID_NAMEREF_VALUE) {
|
|
|
e6eb8e |
+ free (namevar);
|
|
|
e6eb8e |
+ return;
|
|
|
e6eb8e |
+ }
|
|
|
e6eb8e |
if (v && nameref_p (v))
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
free (cp->c_name);
|
|
|
e6eb8e |
@@ -2210,6 +2212,7 @@ coproc_setvars (cp)
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
if (readonly_p (v))
|
|
|
e6eb8e |
err_readonly (cp->c_name);
|
|
|
e6eb8e |
+ free (namevar);
|
|
|
e6eb8e |
return;
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
if (v == 0)
|
|
|
e6eb8e |
@@ -5528,7 +5531,6 @@ shell_execve (command, args, env)
|
|
|
e6eb8e |
char *interp;
|
|
|
e6eb8e |
int ilen;
|
|
|
e6eb8e |
|
|
|
e6eb8e |
- close (fd);
|
|
|
e6eb8e |
interp = getinterp (sample, sample_len, (int *)NULL);
|
|
|
e6eb8e |
ilen = strlen (interp);
|
|
|
e6eb8e |
errno = i;
|
|
|
e6eb8e |
diff --git a/expr.c b/expr.c
|
|
|
e6eb8e |
index 172964a..5dc57c0 100644
|
|
|
e6eb8e |
--- a/expr.c
|
|
|
e6eb8e |
+++ b/expr.c
|
|
|
e6eb8e |
@@ -207,7 +207,8 @@ static intmax_t exp5 __P((void));
|
|
|
e6eb8e |
static intmax_t exp4 __P((void));
|
|
|
e6eb8e |
static intmax_t expshift __P((void));
|
|
|
e6eb8e |
static intmax_t exp3 __P((void));
|
|
|
e6eb8e |
-static intmax_t exp2 __P((void));
|
|
|
e6eb8e |
+/* Avoid name clash with standard exp2 */
|
|
|
e6eb8e |
+static intmax_t bash_exp2 __P((void));
|
|
|
e6eb8e |
static intmax_t exppower __P((void));
|
|
|
e6eb8e |
static intmax_t exp1 __P((void));
|
|
|
e6eb8e |
static intmax_t exp0 __P((void));
|
|
|
e6eb8e |
@@ -809,14 +810,14 @@ exp3 ()
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
register intmax_t val1, val2;
|
|
|
e6eb8e |
|
|
|
e6eb8e |
- val1 = exp2 ();
|
|
|
e6eb8e |
+ val1 = bash_exp2 ();
|
|
|
e6eb8e |
|
|
|
e6eb8e |
while ((curtok == PLUS) || (curtok == MINUS))
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
int op = curtok;
|
|
|
e6eb8e |
|
|
|
e6eb8e |
readtok ();
|
|
|
e6eb8e |
- val2 = exp2 ();
|
|
|
e6eb8e |
+ val2 = bash_exp2 ();
|
|
|
e6eb8e |
|
|
|
e6eb8e |
if (op == PLUS)
|
|
|
e6eb8e |
val1 += val2;
|
|
|
e6eb8e |
@@ -828,7 +829,7 @@ exp3 ()
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
|
|
|
e6eb8e |
static intmax_t
|
|
|
e6eb8e |
-exp2 ()
|
|
|
e6eb8e |
+bash_exp2 ()
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
register intmax_t val1, val2;
|
|
|
e6eb8e |
#if defined (HAVE_IMAXDIV)
|
|
|
e6eb8e |
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
|
|
|
e6eb8e |
index 7f6eafe..c018e29 100644
|
|
|
e6eb8e |
--- a/lib/glob/glob.c
|
|
|
e6eb8e |
+++ b/lib/glob/glob.c
|
|
|
e6eb8e |
@@ -576,7 +576,7 @@ glob_vector (pat, dir, flags)
|
|
|
e6eb8e |
register char *nextname, *npat, *subdir;
|
|
|
e6eb8e |
unsigned int count;
|
|
|
e6eb8e |
int lose, skip, ndirs, isdir, sdlen, add_current, patlen;
|
|
|
e6eb8e |
- register char **name_vector;
|
|
|
e6eb8e |
+ register char **name_vector = NULL;
|
|
|
e6eb8e |
register unsigned int i;
|
|
|
e6eb8e |
int mflags; /* Flags passed to strmatch (). */
|
|
|
e6eb8e |
int pflags; /* flags passed to sh_makepath () */
|
|
|
e6eb8e |
@@ -894,7 +894,7 @@ glob_vector (pat, dir, flags)
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
|
|
|
e6eb8e |
/* Don't call QUIT; here; let higher layers deal with it. */
|
|
|
e6eb8e |
-
|
|
|
e6eb8e |
+ FREE (name_vector);
|
|
|
e6eb8e |
return ((char **)NULL);
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
|
|
|
e6eb8e |
diff --git a/lib/sh/pathcanon.c b/lib/sh/pathcanon.c
|
|
|
e6eb8e |
index f19bd55..2a565d6 100644
|
|
|
e6eb8e |
--- a/lib/sh/pathcanon.c
|
|
|
e6eb8e |
+++ b/lib/sh/pathcanon.c
|
|
|
e6eb8e |
@@ -227,7 +227,7 @@ sh_canonpath (path, flags)
|
|
|
e6eb8e |
if (result[2] == '\0') /* short-circuit for bare `//' */
|
|
|
e6eb8e |
result[1] = '\0';
|
|
|
e6eb8e |
else
|
|
|
e6eb8e |
- strcpy (result, result + 1);
|
|
|
e6eb8e |
+ memmove(result, result + 1, strlen(result + 1) + 1);
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
|
|
|
e6eb8e |
return (result);
|
|
|
e6eb8e |
diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c
|
|
|
e6eb8e |
index 26016b7..b64c4cd 100644
|
|
|
e6eb8e |
--- a/lib/sh/pathphys.c
|
|
|
e6eb8e |
+++ b/lib/sh/pathphys.c
|
|
|
e6eb8e |
@@ -245,7 +245,7 @@ error:
|
|
|
e6eb8e |
if (result[2] == '\0') /* short-circuit for bare `//' */
|
|
|
e6eb8e |
result[1] = '\0';
|
|
|
e6eb8e |
else
|
|
|
e6eb8e |
- strcpy (result, result + 1);
|
|
|
e6eb8e |
+ memmove(result, result + 1, strlen(result + 1) + 1);
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
|
|
|
e6eb8e |
return (result);
|
|
|
e6eb8e |
diff --git a/shell.c b/shell.c
|
|
|
e6eb8e |
index b43de50..4aae182 100644
|
|
|
e6eb8e |
--- a/shell.c
|
|
|
e6eb8e |
+++ b/shell.c
|
|
|
e6eb8e |
@@ -1948,8 +1948,10 @@ show_shell_usage (fp, extra)
|
|
|
e6eb8e |
fputs (_("\t-ilrsD or -c command or -O shopt_option\t\t(invocation only)\n"), fp);
|
|
|
e6eb8e |
|
|
|
e6eb8e |
for (i = 0, set_opts = 0; shell_builtins[i].name; i++)
|
|
|
e6eb8e |
- if (STREQ (shell_builtins[i].name, "set"))
|
|
|
e6eb8e |
+ if (STREQ (shell_builtins[i].name, "set")) {
|
|
|
e6eb8e |
set_opts = savestring (shell_builtins[i].short_doc);
|
|
|
e6eb8e |
+ break;
|
|
|
e6eb8e |
+ }
|
|
|
e6eb8e |
if (set_opts)
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
s = strchr (set_opts, '[');
|
|
|
e6eb8e |
diff --git a/subst.c b/subst.c
|
|
|
e6eb8e |
index 5f3e41e..7574617 100644
|
|
|
e6eb8e |
--- a/subst.c
|
|
|
e6eb8e |
+++ b/subst.c
|
|
|
e6eb8e |
@@ -5182,8 +5182,11 @@ parameter_list_transform (xc, itype, quoted)
|
|
|
e6eb8e |
list = list_rest_of_args ();
|
|
|
e6eb8e |
if (list == 0)
|
|
|
e6eb8e |
return ((char *)NULL);
|
|
|
e6eb8e |
- if (xc == 'A')
|
|
|
e6eb8e |
- return (pos_params_assignment (list, itype, quoted));
|
|
|
e6eb8e |
+ if (xc == 'A') {
|
|
|
e6eb8e |
+ ret = pos_params_assignment (list, itype, quoted);
|
|
|
e6eb8e |
+ dispose_words (list);
|
|
|
e6eb8e |
+ return (ret);
|
|
|
e6eb8e |
+ }
|
|
|
e6eb8e |
ret = list_transform (xc, (SHELL_VAR *)0, list, itype, quoted);
|
|
|
e6eb8e |
dispose_words (list);
|
|
|
e6eb8e |
return (ret);
|
|
|
e6eb8e |
@@ -6813,6 +6816,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
report_error (_("%s: invalid indirect expansion"), name);
|
|
|
e6eb8e |
free (vname);
|
|
|
e6eb8e |
+ free (t1);
|
|
|
e6eb8e |
dispose_word (w);
|
|
|
e6eb8e |
return &expand_wdesc_error;
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
@@ -6820,6 +6824,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, pflags, qdollaratp, hasdolla
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
report_error (_("%s: invalid variable name"), vname);
|
|
|
e6eb8e |
free (vname);
|
|
|
e6eb8e |
+ free (t1);
|
|
|
e6eb8e |
dispose_word (w);
|
|
|
e6eb8e |
return &expand_wdesc_error;
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
diff --git a/support/man2html.c b/support/man2html.c
|
|
|
e6eb8e |
index 6ba5061..1d9e376 100644
|
|
|
e6eb8e |
--- a/support/man2html.c
|
|
|
e6eb8e |
+++ b/support/man2html.c
|
|
|
e6eb8e |
@@ -522,6 +522,7 @@ read_man_page(char *filename)
|
|
|
e6eb8e |
man_buf[buf_size] = '\n';
|
|
|
e6eb8e |
man_buf[buf_size + 1] = man_buf[buf_size + 2] = '\0';
|
|
|
e6eb8e |
} else {
|
|
|
e6eb8e |
+ free (man_buf);
|
|
|
e6eb8e |
man_buf = NULL;
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
fclose(man_stream);
|
|
|
e6eb8e |
@@ -2562,7 +2563,6 @@ scan_request(char *c)
|
|
|
e6eb8e |
h = name;
|
|
|
e6eb8e |
if (stat(h, &stbuf) != -1)
|
|
|
e6eb8e |
l = stbuf.st_size;
|
|
|
e6eb8e |
- buf = stralloc(l + 4);
|
|
|
e6eb8e |
#if NOCGI
|
|
|
e6eb8e |
if (!out_length) {
|
|
|
e6eb8e |
char *t, *s;
|