mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-11 08:21:13 +01:00
17516, 17517: Attempted fixes for memory leaks shown by valgrind.
First with zstyle patterns, second with pwd in job structure.
This commit is contained in:
parent
cea681c928
commit
f60279ae24
3 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2002-08-08 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 17517: Src/jobs.c: Another memory leak was showing up with the
|
||||
pwd field of the job structure, this attempts to rationalise it.
|
||||
|
||||
* 17516: Src/Modules/zutil.c: Memory leak with compiled patterns
|
||||
for zstyle shown up by Felix's valgrind test.
|
||||
|
||||
2002-08-07 Clint Adams <clint@zsh.org>
|
||||
|
||||
* 17509: Completion/Unix/Command/_lynx: complete .xhtml files as well
|
||||
|
|
|
@ -119,7 +119,10 @@ setstypat(Style s, char *pat, Patprog prog, char **vals, int eval)
|
|||
errflag = ef;
|
||||
|
||||
if (!eprog)
|
||||
{
|
||||
freepatprog(prog);
|
||||
return 1;
|
||||
}
|
||||
|
||||
eprog = dupeprog(eprog, 0);
|
||||
}
|
||||
|
@ -134,6 +137,7 @@ setstypat(Style s, char *pat, Patprog prog, char **vals, int eval)
|
|||
freeeprog(p->eval);
|
||||
p->vals = zarrdup(vals);
|
||||
p->eval = eprog;
|
||||
freepatprog(prog);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -979,6 +979,10 @@ clearjobtab(int monitor)
|
|||
zfree(jobtab[i].ty, sizeof(struct ttyinfo));
|
||||
jobtab[i].ty = NULL;
|
||||
}
|
||||
if (jobtab[i].pwd) {
|
||||
zsfree(jobtab[i].pwd);
|
||||
jobtab[i].pwd = NULL;
|
||||
}
|
||||
if (monitor) {
|
||||
/*
|
||||
* See if there is a jobtable worth saving.
|
||||
|
@ -1011,8 +1015,10 @@ initjob(void)
|
|||
for (i = 1; i < MAXJOB; i++)
|
||||
if (!jobtab[i].stat) {
|
||||
jobtab[i].stat = STAT_INUSE;
|
||||
if (jobtab[i].pwd)
|
||||
if (jobtab[i].pwd) {
|
||||
zsfree(jobtab[i].pwd);
|
||||
jobtab[i].pwd = NULL;
|
||||
}
|
||||
jobtab[i].gleader = 0;
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue