binfmt: Fix memory leak in ELF loader
Summary: - I noticed that the hello (ELF) application causes a memory leak. - Finally, I found that the data section is not deallocated. - This commit fixes this issue. Impact: - None Testing: - Tested with spresense:wifi_smp, rv-virt:nsh64, sabre-6quad:netnsh Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
e937cfcbce
commit
23d57be21b
|
@ -277,9 +277,10 @@ static int elf_loadbinary(FAR struct binary_s *binp,
|
||||||
up_addrenv_clone(&loadinfo.addrenv, &binp->addrenv);
|
up_addrenv_clone(&loadinfo.addrenv, &binp->addrenv);
|
||||||
#else
|
#else
|
||||||
binp->alloc[0] = (FAR void *)loadinfo.textalloc;
|
binp->alloc[0] = (FAR void *)loadinfo.textalloc;
|
||||||
|
binp->alloc[1] = (FAR void *)loadinfo.dataalloc;
|
||||||
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
#ifdef CONFIG_BINFMT_CONSTRUCTORS
|
||||||
binp->alloc[1] = loadinfo.ctoralloc;
|
binp->alloc[2] = loadinfo.ctoralloc;
|
||||||
binp->alloc[2] = loadinfo.dtoralloc;
|
binp->alloc[3] = loadinfo.dtoralloc;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define BINFMT_NALLOC 3
|
#define BINFMT_NALLOC 4
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
|
|
Loading…
Reference in New Issue