Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jun 2002 15:57:23 -0700 (PDT)
From:      Nathan Mower <nmower@verio.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/39314: Memory leak in setenv
Message-ID:  <200206142257.g5EMvNLO093586@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         39314
>Category:       misc
>Synopsis:       Memory leak in setenv
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 14 16:00:12 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Nathan Mower
>Release:        4.4, 4.5, 4.6-RC, 5
>Organization:
NTT/Verio
>Environment:
FreeBSD hostname 4.4-RELEASE FreeBSD 4.4-RELEASE #1: Wed Jan 23 11:05:43 MST 2002 root@hostname:/usr/src/sys/compile/WHATEVER  i386
>Description:
      There is a memory leak in setenv in the case where a name/value pair already exists and the new value is larger than the old one.  Setenv does not free the old memory before it malloc's space for the new string.
>How-To-Repeat:
      setenv("HOME", "/usr/home/abc", 1);
      setenv("HOME", "/usr/home/abcdefghijklmnopqrstuvwxyz", 1);
>Fix:
      free the old environ[offset] before malloc'ing the new one.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206142257.g5EMvNLO093586>