develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu

From:
pausmith
Date:
November 17, 1999 17:18
Subject:
Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu
Message ID:
p5so241ttt.fsf@baynetworks.com
%% Ilya Zakharevich <ilya@math.ohio-state.edu> writes:

  iz> OK, now it is us who look utterly confused...  I was pretty sure
  iz> that documentation of putenv() states that it free()s the old
  iz> value,

No, it doesn't.  For one thing, there's no requirement that the memory
you pass to it be on the heap.

  iz> but most probably it just leaks...

If you pass it an alloc'ed block and don't save a pointer to it yourself
to free later, if you know when "later" is, yes, it does.

putenv() is a crappy function.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About