This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Memory leak in object loader?


Hi all,

I think there is a memory leak in the object loader in the file
objelf.c in function 'cyg_ldr_relocate_section'.

In the beginning of this function 'cyg_ldr_load_elf_section' is called
and it's result is stored in a local variable p_rela or p_rel.
However at the end of the function the section is freed with
'cyg_ldr_delete_elf_section' which get's its section pointer from the
sections
array (which is 0 because it was never stored there!).

I fixed this by calling 'cyg_ldr_free' directly from within
'cyg_ldr_relocate_section' as you can see in the attached patch.

Is this the correct way to fix this leak, or should the pointer be
stored in the sections array?
(It fixed the leak in my case anyway)

Davy

Attachment: fix.diff
Description: Binary data

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]