From owner-freebsd-bugs Wed Jan 26 15: 0: 4 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 3953A14FB7 for ; Wed, 26 Jan 2000 15:00:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA64587; Wed, 26 Jan 2000 15:00:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Wed, 26 Jan 2000 15:00:01 -0800 (PST) Message-Id: <200001262300.PAA64587@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Jeremy Subject: Re: bin/10342: putenv(3) unnecessarily calls strdup/free Reply-To: Peter Jeremy Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/10342; it has been noted by GNATS. From: Peter Jeremy To: "Rodney W. Grimes" 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" 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