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

sh_debug(): restore NV_NOFREE attributes (re: c928046a)

Removing the nv_putval() calls also stopped making sure the
NV_NOFREE attribute was set for those variables, causing an invalid
free later on. This caused the funcname.ksh script:
https://gist.github.com/ormaaj/12874b68acd06ee98b59
to crash even more readily than it did before.

Even after this commit there are various crashing bugs left for
that script, all intermittent and with different backtraces and
dependent on the operating system and malloc variant used.
Investigation ongoing at: https://github.com/ksh93/ksh/issues/212
This commit is contained in:
Martijn Dekker 2021-03-08 20:49:02 +00:00
parent 5aba0c7251
commit e58637752a

View file

@ -695,6 +695,8 @@ int sh_debug(Shell_t *shp, const char *trap, const char *name, const char *subsc
n = sh_trap(trap,0); n = sh_trap(trap,0);
np->nvalue.cp = 0; np->nvalue.cp = 0;
shp->indebug = 0; shp->indebug = 0;
nv_onattr(SH_PATHNAMENOD,NV_NOFREE);
nv_onattr(SH_FUNNAMENOD,NV_NOFREE);
if(shp->st.cmdname) if(shp->st.cmdname)
error_info.id = shp->st.cmdname; error_info.id = shp->st.cmdname;
shp->st = savst; shp->st = savst;