mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix several memory leaks related to arrays (rhbz#921455)
I now have access to some of the private bugs on the Red Hat bug
tracker. This one doesn't have a lot of information on the patch,
but it contains a good reproducer, so we can at least verify that
it works.
src/cmd/ksh93/sh/array.c,
src/cmd/ksh93/sh/name.c:
- Apply the patch associated with Red Hat bug #921455. Source:
642af4d6/f/ksh-20120801-memlik.patch
This was applied to Red Hat's ksh on 04 Jul 2013.
src/cmd/ksh93/tests/leaks.sh:
- Add leak tests for associative and indexed arrays in functions
based on the reproducer from rhbz#921455.
- Both tests still leak (though much less) when run in a locale
other than C. For now, temporarily set the locale to C and add
a TODO note. Perhaps another Red Hat patch is yet to fix this.
This commit is contained in:
parent
16e4824c45
commit
05683ec75b
3 changed files with 42 additions and 1 deletions
|
@ -1685,7 +1685,11 @@ void *nv_associative(register Namval_t *np,const char *sp,int mode)
|
|||
ap->header.scope = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((ap->header.nelem&ARRAY_MASK)==0 && (ap->cur=nv_search("0",ap->header.table,0)))
|
||||
nv_associative(np,(char*)0,NV_ADELETE);
|
||||
dtclose(ap->header.table);
|
||||
}
|
||||
return((void*)ap);
|
||||
case NV_ANEXT:
|
||||
if(!ap->pos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue