[9607] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: rt 7.4G: memory leak in BSD setenv()

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Mon Jul 13 15:31:08 1992

Date: Mon, 13 Jul 92 15:30:50 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: "Barr3y Jaspan" <bjaspan@Athena.MIT.EDU>
Cc: bugs@Athena.MIT.EDU
In-Reply-To: [9595]

Although I cannot say for sure, my suspicion is that setenv() does not
free the memory location that is being replaced because there is no
way for it to know whether or not that memory was allocated with
malloc.  If the variable being reset was part of the original
environment with which the process was started, then it was not
allocated with malloc, and therefore cannot be freed.

I guess the assumption is that since environment variables are changed
pretty infrequently, the leak wasn't worth worrying about.  However,
even if it were worth worrying about, I'm really not sure how the
problem could be solved without possibly freeing memory locations that
shouldn't be freed.

I'm just postulating here.... I'd love to have someone confirm my
suspicions :-)

 Jonathan Kamens
 IS/Athena Quality Assurance


home help back first fref pref prev next nref lref last post