Hi,

as described in my former mail about the not initialized variables I had
debugged a very nasty crash happens on on some architectures at the
customer using a throttled AMD Opteron[tm] 6128.  Here I've not found
a similar host to reproduce this crash.  Therefore I used valgrind for
debugging.  I've found that data structures if the dttree used for
loadable shell functions from FPATH will be freed after the second
file for defining a shell function was loaded will be freed even if
in use in that dttree (Dtdisc_t _Rpdisc).

The patch in the attachment is used to work around this problem.
Maybe there is a better way for doing this by e.g. using a further
field `nofree' in struct Ufunction.


     Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c	2013-02-01 16:22:50.000000000 +0000
@@ -2741,11 +2741,6 @@ int sh_exec(register const Shnode_t *t,
 				slp = (struct slnod*)np->nvenv;
 				sh_funstaks(slp->slchild,-1);
 				stakdelete(slp->slptr);
-				if(shp->funload)
-				{
-					free((void*)np->nvalue.rp);
-					np->nvalue.rp = 0;
-				}
 				if(rp->sdict)
 				{
 					Namval_t *mp, *nq;
@@ -2759,6 +2754,12 @@ int sh_exec(register const Shnode_t *t,
 					dtclose(rp->sdict);
 					rp->sdict = 0;
 				}
+				if(shp->funload)
+				{
+					if(!shp->fpathdict)
+						free((void*)np->nvalue.rp);
+					np->nvalue.rp = 0;
+				}
 			}
 			if(!np->nvalue.rp)
 			{
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to