Cleanups from valgrind.
This commit is contained in:
parent
7db55ba13f
commit
3358f3f36b
@ -1,3 +1,8 @@
|
|||||||
|
2020-01-01 Arnold D. Robbins <arnold@skeeve.com>
|
||||||
|
|
||||||
|
* tran.c (syminit, arginit, envinit): Free sval member before
|
||||||
|
setting it. Thanks to valgrind.
|
||||||
|
|
||||||
2019-12-27 Arnold D. Robbins <arnold@skeeve.com>
|
2019-12-27 Arnold D. Robbins <arnold@skeeve.com>
|
||||||
|
|
||||||
* b.c (replace_repeat): Fix a bug whereby a{0,3} could match
|
* b.c (replace_repeat): Fix a bug whereby a{0,3} could match
|
||||||
|
3
tran.c
3
tran.c
@ -114,6 +114,7 @@ void syminit(void) /* initialize symbol table with builtin vars */
|
|||||||
rlengthloc = setsymtab("RLENGTH", "", 0.0, NUM, symtab);
|
rlengthloc = setsymtab("RLENGTH", "", 0.0, NUM, symtab);
|
||||||
RLENGTH = &rlengthloc->fval;
|
RLENGTH = &rlengthloc->fval;
|
||||||
symtabloc = setsymtab("SYMTAB", "", 0.0, ARR, symtab);
|
symtabloc = setsymtab("SYMTAB", "", 0.0, ARR, symtab);
|
||||||
|
free(symtabloc->sval);
|
||||||
symtabloc->sval = (char *) symtab;
|
symtabloc->sval = (char *) symtab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +127,7 @@ void arginit(int ac, char **av) /* set up ARGV and ARGC */
|
|||||||
ARGC = &setsymtab("ARGC", "", (Awkfloat) ac, NUM, symtab)->fval;
|
ARGC = &setsymtab("ARGC", "", (Awkfloat) ac, NUM, symtab)->fval;
|
||||||
cp = setsymtab("ARGV", "", 0.0, ARR, symtab);
|
cp = setsymtab("ARGV", "", 0.0, ARR, symtab);
|
||||||
ARGVtab = makesymtab(NSYMTAB); /* could be (int) ARGC as well */
|
ARGVtab = makesymtab(NSYMTAB); /* could be (int) ARGC as well */
|
||||||
|
free(cp->sval);
|
||||||
cp->sval = (char *) ARGVtab;
|
cp->sval = (char *) ARGVtab;
|
||||||
for (i = 0; i < ac; i++) {
|
for (i = 0; i < ac; i++) {
|
||||||
sprintf(temp, "%d", i);
|
sprintf(temp, "%d", i);
|
||||||
@ -144,6 +146,7 @@ void envinit(char **envp) /* set up ENVIRON variable */
|
|||||||
|
|
||||||
cp = setsymtab("ENVIRON", "", 0.0, ARR, symtab);
|
cp = setsymtab("ENVIRON", "", 0.0, ARR, symtab);
|
||||||
ENVtab = makesymtab(NSYMTAB);
|
ENVtab = makesymtab(NSYMTAB);
|
||||||
|
free(cp->sval);
|
||||||
cp->sval = (char *) ENVtab;
|
cp->sval = (char *) ENVtab;
|
||||||
for ( ; *envp; envp++) {
|
for ( ; *envp; envp++) {
|
||||||
if ((p = strchr(*envp, '=')) == NULL)
|
if ((p = strchr(*envp, '=')) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user