From owner-freebsd-bugs Fri Jun 14 16: 0:31 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6075F37B415 for ; Fri, 14 Jun 2002 16:00:12 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5EN0CS77473; Fri, 14 Jun 2002 16:00:12 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id E71D837B401 for ; Fri, 14 Jun 2002 15:57:23 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g5EMvNhG093587 for ; Fri, 14 Jun 2002 15:57:23 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g5EMvNLO093586; Fri, 14 Jun 2002 15:57:23 -0700 (PDT) Message-Id: <200206142257.g5EMvNLO093586@www.freebsd.org> Date: Fri, 14 Jun 2002 15:57:23 -0700 (PDT) From: Nathan Mower To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/39314: Memory leak in setenv Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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