Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2000 15:00:01 -0800 (PST)
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/10342: putenv(3) unnecessarily calls strdup/free
Message-ID:  <200001262300.PAA64587@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/10342; it has been noted by GNATS.

From: Peter Jeremy <peter.jeremy@alcatel.com.au>
To: "Rodney W. Grimes" <rgrimes@gndrsh.dnsmgr.net>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/10342: putenv(3) unnecessarily calls strdup/free
Date: Thu, 27 Jan 2000 09:56:47 +1100

 On 2000-Jan-27 09:19:24 +1100, "Rodney W. Grimes" <rgrimes@gndrsh.dnsmgr.net> wrote:
 >a)  This is tried and true tested code that has not been modified
 >    since 4.4BSD Lite.
 Accepted.  (Though I don't believe that this _automatically_ makes the
 code perfect).
 
 >b)  The man page says ``the given arguments name and value may be appended
 >    and prepended, respectively, with an equal sign ``=''.''  It does not
 >    say that you can have additional stuff after the =, your patch leaves
 >    stuff after the =.
 
 A slight difference in interpretation: I read the manual page as
 meaning that the name argument to setenv() could be _terminated_ with
 either NUL ('\0') or '=' - ie what came after the '=' is irrelevant.
 
 The current implementation of setenv() (and __findenv()) does treat a
 trailing '=' as a terminator.  (And I'm not sure how/why someone would
 write code that accepted and ignored '=', but did not treat it as a
 terminator).
 
 >The PR eludes to a memory leak, can you be more specific on exactly how
 >this memory leak occurs as I do not see a memory leak in putenv as the
 >code is now.
 
 An associated PR (bin/10341) discusses a memory leak in setenv()
 (which was previously mentioned in bin/5604).  I have no evidence for
 a memory leak within putenv() itself (though my demonstration code for
 bin/10341 uses putenv()).  My bin/10342 was solely an efficiency
 improvement (removing calls to strdup/free).
 
 If you are not comfortable with this change, I'll accept your right to
 refuse to apply it.  I was just going through my outstanding PR's and
 prodding people over the ones I saw as trivial.
 
 Peter
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001262300.PAA64587>