NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/43899: setenv(3)/unsetenv(3) memory leak



>Number:         43899
>Category:       lib
>Synopsis:       setenv(3)/unsetenv(3) memory leak
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 23 13:10:00 +0000 2010
>Originator:     Nicolas Joly
>Release:        NetBSD 5.99.39
>Organization:
Institut Pasteur
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 5.99.39 NetBSD 5.99.39 (LANFEUST) #9: 
Thu Sep 23 14:27:34 CEST 2010 
njoly%lanfeust.sis.pasteur.fr@localhost:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST
 amd64
Architecture: x86_64
Machine: amd64
>Description:
I just noticed that unsetenv(3) does not seems to reclaim memory that was
allocated by setenv(3) for a single variable.
>How-To-Repeat:
Compile the following piece of code, run it and watch the process eating
memory.

#include <stdlib.h>
int main() {
  while (1) {
    setenv("dummyvar", "dummyval", 0);
    unsetenv("dummyvar"); }
  return 0; }

>Fix:



Home | Main Index | Thread Index | Old Index