Wind River Support Network

HomeDefectsLIN6-8587
Fixed

LIN6-8587 : CLONE - gcc : RCPl 26 : wrl 4.3 : memory leak when loading shared objects

Created: Oct 19, 2014    Updated: Dec 3, 2018
Resolved Date: Oct 20, 2014
Previous ID: LIN4-31850
Found In Version: 6.0
Fix Version: 6.0.0.13
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Toolchain

Description

A memory leak is observed inside _dl_map_object_deps(). The following malloc()
causes leak
...
            l_reldeps = malloc (sizeof (*l_reldeps)    
                                + map->l_reldepsmax
                                  * sizeof (struct link_map *));
...

The issue can be reproduced using a minimal test scenario which is shown below
...
   * libX.so
       \--------> libA.so
       \--------> libB.so
       \--------> libC.so

   * libA.so
       \-------> libB.so
       \........................> libC.so ( relocation dependency)

   * libB.so
       \-------> libC.so
 * main application
  {
   ...
   dlopen(libX.so);
   ...
   dlopen(libA.so)
   }

...

Testcode to reproduce this issue is attached. 

see code attached

Steps to Reproduce

configure common_pc_64 glibc std project
make buiild-all
make export-sysroot
set path for the compiler
extract the attached test.tar.gz.
in build.sh change the gcc to the target compiler (glibc-std)
./build.sh

copy testcase to target and the shared libs to /lib64

->  valgrind --leak-check ./main

-> check that 88 bytes are not given back to heap.

Other Downloads


Live chat
Online