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
Institut Pasteur
System: NetBSD 5.99.39 NetBSD 5.99.39 (LANFEUST) #9: 
Thu Sep 23 14:27:34 CEST 2010
Architecture: x86_64
Machine: amd64
I just noticed that unsetenv(3) does not seems to reclaim memory that was
allocated by setenv(3) for a single variable.
Compile the following piece of code, run it and watch the process eating

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


Home | Main Index | Thread Index | Old Index