author | Lijo George<lijo.x.george@oracle.com> |
Sat, 02 Apr 2016 10:30:42 -0700 | |
changeset 5714 | 02476113ab6b |
permissions | -rw-r--r-- |
5714
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
1 |
This fix is from the community, details in the following location. |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
2 |
https://www.mail-archive.com/[email protected]/msg01017.html |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
3 |
--- INIT.2011-02-08.old/src/cmd/ksh93/sh/name.c 2015-04-14 13:17:18.598612500 -0700 |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
4 |
+++ INIT.2011-02-08/src/cmd/ksh93/sh/name.c 2015-04-14 13:28:33.128198600 -0700 |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
5 |
@@ -1301,7 +1301,17 @@ |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
6 |
if(dtdelete(root,np)) |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
7 |
{ |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
8 |
if(!(flags&NV_NOFREE) && ((flags&NV_FUNCTION) || !nv_subsaved(np))) |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
9 |
+ { |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
10 |
+ Namarr_t *ap; |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
11 |
+ if(nv_isarray(np) && np->nvfun && |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
12 |
+ (ap=nv_arrayptr(np)) && array_assoc(ap)) { |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
13 |
+ while(nv_associative(np,0,NV_ANEXT)) |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
14 |
+ nv_associative(np, 0, NV_ADELETE); |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
15 |
+ nv_associative(np, 0, NV_AFREE); |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
16 |
+ free((void*)np->nvfun); |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
17 |
+ } |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
18 |
free((void*)np); |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
19 |
+ } |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
20 |
} |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
21 |
#if 0 |
02476113ab6b
22964126 ksh93 memory leak:unset is not properly freeing members of an associative array
Lijo George<lijo.x.george@oracle.com>
parents:
diff
changeset
|
22 |
else |