misc/55181: Memory leak in vfprintf()

Ryan T.Dean rtdean at cytherianage.net
Sat Aug 2 02:20:07 PDT 2003


>Number:         55181
>Category:       misc
>Synopsis:       Memory leak in vfprintf()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 02 02:20:04 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ryan T. Dean
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
<organization of PR author (multiple lines)>
>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 at 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 at 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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list