1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Update comsub-with-alias anti-leak hack (re: fe20311f)

In the 93v- beta, they add a newline instead of a space.
This has fewer side effects as final newlines get stripped.
It's still a hack and it would still be nice to have a real fix,
but it seems even the AT&T guys couldn't come up with one.

src/cmd/ksh93/sh/macro.c:
- To somehow avoid a memory leak involving alias substitution,
  append a linefeed instead of a space to the comsub buffer.

src/cmd/ksh93/tests/subshell.sh:
- Add test for minor regression caused by the RedHat version.
This commit is contained in:
Martijn Dekker 2021-02-18 23:24:50 +00:00
parent 72968eaed6
commit 350b52ea4e
2 changed files with 11 additions and 1 deletions

View file

@ -2118,7 +2118,7 @@ static void comsubst(Mac_t *mp,register Shnode_t* t, int type)
}
sfputc(stkp,c);
}
sfputc(stkp,' '); /* rhbz#982142: a=`some_alias` leaked memory, a=`some_alias ` did not! TODO: non-hack fix */
sfputc(stkp,'\n'); /* a=`some_alias` leaked memory, a=`some_alias<LF>` did not! TODO: non-hack fix */
c = stktell(stkp);
str=stkfreeze(stkp,1);
/* disable verbose and don't save in history file */