git: libc -- dmalloc: Call malloc_init as-needed, rather than via cc constructor.

Venkatesh Srinivas vsrinivas at crater.dragonflybsd.org
Sun May 20 07:26:14 PDT 2012


commit e12d3396c777165504d60d2a1408dcd7cb63660d
Author: Venkatesh Srinivas <me at endeavour.zapto.org>
Date:   Sun May 20 07:10:56 2012 -0700

    libc -- dmalloc: Call malloc_init as-needed, rather than via cc constructor.
    
    dmalloc requires its own _nmalloc_thr_init be called before it can service
    allocations. Applications with preinit arrays were able to call malloc before
    constructors ran, which caused them to crash on uninitialized allocator state.
    
    The change uses a flag to test for allocator init state. It is also careful
    to not allow _nmalloc_thr_init to be called recursively from within pthread
    initialization (slglobal.masked).
    
    Reported-by: marino@
    Closes-bug: 2305

Summary of changes:
 lib/libc/stdlib/dmalloc.c |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e12d3396c777165504d60d2a1408dcd7cb63660d


-- 
DragonFly BSD source repository





More information about the Commits mailing list