summaryrefslogtreecommitdiffstats
path: root/source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch')
-rw-r--r--source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch b/source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch
new file mode 100644
index 000000000..1af7d1664
--- /dev/null
+++ b/source/ap/ksh93/patches/ksh-20120801-assoc-unset-leak.patch
@@ -0,0 +1,20 @@
+diff -up ksh-20120801/src/cmd/ksh93/sh/name.c.orig ksh-20120801/src/cmd/ksh93/sh/name.c
+--- ksh-20120801/src/cmd/ksh93/sh/name.c.orig 2015-02-10 17:15:37.180783550 -0200
++++ ksh-20120801/src/cmd/ksh93/sh/name.c 2015-02-10 18:25:51.726228437 -0200
+@@ -1298,7 +1298,16 @@ void nv_delete(Namval_t* np, Dt_t *root,
+ if(dtdelete(root,np))
+ {
+ if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np,flags&NV_TABLE)))
++ {
++ Namarr_t *ap;
++ if(nv_isarray(np) && np->nvfun && (ap=nv_arrayptr(np)) && array_assoc(ap)) {
++ while(nv_associative(np,0,NV_ANEXT))
++ nv_associative(np, 0, NV_ADELETE);
++ nv_associative(np, 0, NV_AFREE);
++ free((void*)np->nvfun);
++ }
+ free((void*)np);
++ }
+ }
+ #if 0
+ else