diff options
| author | Peter Stephenson <pws@users.sourceforge.net> | 2002-08-08 10:43:50 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@users.sourceforge.net> | 2002-08-08 10:43:50 +0000 |
| commit | f60279ae24e66cb2365eadc25f847f908adf9399 (patch) | |
| tree | 13ac9ba5be6b27c9b71842998cbdd9d7e6ec6fbb /Src | |
| parent | 17509: complete .xhtml files as well as .html files. (diff) | |
| download | zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar.gz zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar.bz2 zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar.lz zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar.xz zsh-f60279ae24e66cb2365eadc25f847f908adf9399.tar.zst zsh-f60279ae24e66cb2365eadc25f847f908adf9399.zip | |
17516, 17517: Attempted fixes for memory leaks shown by valgrind.
First with zstyle patterns, second with pwd in job structure.
Diffstat (limited to 'Src')
| -rw-r--r-- | Src/Modules/zutil.c | 4 | ||||
| -rw-r--r-- | Src/jobs.c | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index 85ab4b394..cb099bbcc 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -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; } diff --git a/Src/jobs.c b/Src/jobs.c index 548cdb923..a2dbea983 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -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; } |
