Bug 188572

Summary: Valgrind on Mac should suppress setenv() mem leak
Product: [Developer tools] valgrind Reporter: Nirnimesh <nirnimesh>
Component: memcheckAssignee: Nicholas Nethercote <njn>
Status: RESOLVED FIXED    
Severity: normal CC: glider, jseward, njn
Priority: NOR    
Version: 3.5 SVN   
Target Milestone: blocking3.5.0   
Platform: Unlisted Binaries   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nirnimesh 2009-03-31 23:00:35 UTC
setenv() on Mac leaks memory intentionally. (refer: man setenv)
Valgrind should suppress this on Mac.

Probably:
{
 setenv() leaks on Mac intentionally.
   Memcheck:Leak
   ...
   fun:__setenv
   fun:setenv$UNIX2003
}
Comment 1 Nicholas Nethercote 2009-04-01 01:36:19 UTC
For reference, here's the relevant section from the man page:

BUGS
     Successive calls to setenv() or putenv() assigning a differently sized
     value to the same name will result in a memory leak.  The FreeBSD seman-
     tics for these functions (namely, that the contents of value are copied
     and that old values remain accessible indefinitely) make this bug
     unavoidable.  Future versions may eliminate one or both of these semantic
     guarantees in order to fix the bug.
Comment 2 Nicholas Nethercote 2009-06-26 09:00:32 UTC
Fixed in r10380.  Thanks for the report.
Comment 3 Alexander Potapenko 2010-10-26 08:55:49 UTC
This is missing in darwin10.supp since the merge of MACOSX106. Was it intentional?
Comment 4 Julian Seward 2011-02-02 18:18:48 UTC
Fixed, r11519.