Wind River Support Network

HomeDefectsLIN5-19579
Fixed

LIN5-19579 : CLONE - gcc : RCPl 26 : wrl 4.3 : memory leak when loading shared objects

Created: Oct 19, 2014    Updated: Dec 19, 2017
Resolved Date: Nov 11, 2014
Previous ID: LIN4-31849
Found In Version: 5.0.1
Fix Version: 5.0.1.21
Severity: Standard
Applicable for: Wind River Linux 5
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