From rtdean-dated-1059815552.40bf03@cytherianage.net  Sat Aug  2 02:18:54 2003
Return-Path: <rtdean-dated-1059815552.40bf03@cytherianage.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E4A3B37B404
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  2 Aug 2003 02:18:54 -0700 (PDT)
Received: from mtiwmhc11.worldnet.att.net (mtiwmhc11.worldnet.att.net [204.127.131.115])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 748A643FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  2 Aug 2003 02:18:53 -0700 (PDT)
	(envelope-from rtdean-dated-1059815552.40bf03@cytherianage.net)
Received: from mahasamatman.internal.cytherianage.net (96.washington-09rh15rt.dc.dial-access.att.net[12.91.120.96])
          by mtiwmhc11.worldnet.att.net (mtiwmhc11) with SMTP
          id <20030802091851111009kvm3e>; Sat, 2 Aug 2003 09:18:51 +0000
Received: (qmail 280 invoked from network); 2 Aug 2003 09:18:48 -0000
Received: from glyph.internal.cytherianage.net (192.168.177.42)
  by mahasamatman.internal.cytherianage.net with SMTP; 2 Aug 2003 09:18:48 -0000
Message-Id: <20030802091853.748A643FA3@mx1.FreeBSD.org>
Date: Sat, 2 Aug 2003 09:18:52 +0000 (GMT)
From: Ryan T.Dean <rtdean@cytherianage.net>
Reply-To: Ryan T.Dean <rtdean-dated-1059815552.40bf03@cytherianage.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: rwatson@freebsd.org
Subject: Memory leak in vfprintf()
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         55181
>Category:       misc
>Synopsis:       Memory leak in vfprintf()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 02 02:20:04 PDT 2003
>Closed-Date:    Sun Aug 03 23:59:32 PDT 2003
>Last-Modified:  Mon Jul 05 16:47:45 GMT 2004
>Originator:     Ryan T. Dean
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
Under -CURRENT:
System: FreeBSD glyph.cytherianage.net 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Wed Jul 30 16:43:52 EDT 2003 root@glyph.cytherianage.net:/usr/obj/usr/src/sys/GLYPH i386

Under -STABLE:
System: FreeBSD tonberi.cytherianage.net 4.8-STABLE FreeBSD 4.8-STABLE #2: Tue Jul 29 20:46:05 EDT 2003 root@tonberi.cytherianage.net:/usr/obj/usr/src/sys/TONBERI i386

>Description:
A 4096-byte memory leak appears to exist in the FreeBSD libc, involving the stdio functions.  More specifically, the memory is allocated on a call to printf(), which in turn calls vfprintf().  The memory is subsequently never freed.  I have observed this behaviour on -CURRENT as of the 30th of July, and on -STABLE as of the 29th of July.  It was also reported, indirectly, on the FreeBSD ports mailing list on the 21st of July.  It has been observed using dmalloc (devel/dmalloc; dmalloc.com) and NJAMD (sourceforge.net/projects/njamd).

I suspect this problem may also occur in vsprintf() as well.

I have CC'd rwatson@freebsd.org because a 'make -V MAINTAINER' in src/lib/libc returned his email address.  I apologize if this was / is in error.

>How-To-Repeat:
Compile any program that uses vfprintf, and observe it through a memory debugger.  On the first call to vfprintf(), a 4096-byte chunk of memory will be allocated.  It will never be freed.

>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: das 
State-Changed-When: Sun Aug 3 23:58:23 PDT 2003 
State-Changed-Why:  
Not a bug.  See the audit trail for bin/47599. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55181 
>Unformatted:
