From liamfoy@sepulcrum.org  Mon Jul 19 11:05:22 2004
Return-Path: <liamfoy@sepulcrum.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5CDB316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Jul 2004 11:05:22 +0000 (GMT)
Received: from moutvdomng.kundenserver.de (moutvdom.kundenserver.de [212.227.126.249])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8867543D45
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Jul 2004 11:05:21 +0000 (GMT)
	(envelope-from liamfoy@sepulcrum.org)
Received: from [212.227.126.224] (helo=mrvdomng.kundenserver.de)
	by moutvdomng.kundenserver.de with esmtp (Exim 3.35 #1)
	id 1BmVxQ-0004PW-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 19 Jul 2004 13:05:20 +0200
Received: from [217.42.173.217] (helo=liamfoy.ath.cx)
	by mrvdomng.kundenserver.de with esmtp (Exim 3.35 #1)
	id 1BmVxQ-0008OL-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 19 Jul 2004 13:05:20 +0200
Message-Id: <1090235009.0@liamfoy.ath.cx>
Date: Mon, 19 Jul 2004 12:03:29 +0100
From: "Liam J. Foy" <liamfoy@sepulcrum.org>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Subject: [PATCH] tftp memory leak fix
X-Send-Pr-Version: gtk-send-pr 0.3.3 
X-GNATS-Notify:

>Number:         69275
>Category:       bin
>Synopsis:       [PATCH] tftp memory leak fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 19 11:10:23 GMT 2004
>Closed-Date:    Mon Aug 02 16:07:37 GMT 2004
>Last-Modified:  Mon Aug 02 16:07:37 GMT 2004
>Originator:     Liam J. Foy
>Release:        FreeBSD 5.2-RELEASE i386
>Organization:
None 
>Environment:


System: FreeBSD 5.2-RELEASE #4: Sat Jul  3 15:54:48 BST 2004
    liamfoy@liamfoy.ath.cx:/usr/src/sys/i386/compile/Ecthelion



>Description:


The following patch contains a fix for a memory leak within tftp. This was first noticed on the OpenBSD camp.


>How-To-Repeat:





>Fix:


--- /FreeBSD/FreeBSD-current/src/usr.bin/tftp/main.c	2003-10-11 17:27:55.000000000 -0700
+++ main.c	2004-07-19 03:59:11.000000000 -0700
@@ -495,6 +495,7 @@
 		fd = creat(cp, 0644);
 		if (fd < 0) {
 			warn("%s", cp);
+			free(cp);
 			continue;
 		}
 		if (verbose)


>Release-Note:
>Audit-Trail:

From: Maxim Konovalov <maxim@FreeBSD.org>
To: "Liam J. Foy" <liamfoy@sepulcrum.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/69275: [PATCH] tftp memory leak fix
Date: Mon, 19 Jul 2004 19:29:40 +0400 (MSD)

 On Mon, 19 Jul 2004, 12:03+0100, Liam J. Foy wrote:
 
 >
 > >Number:         69275
 > >Category:       bin
 > >Synopsis:       [PATCH] tftp memory leak fix
 [...]
 > >Originator:     Liam J. Foy
 > >Release:        FreeBSD 5.2-RELEASE i386
 
 > The following patch contains a fix for a memory leak within tftp.
 > This was first noticed on the OpenBSD camp.
 
 > >Fix:
 >
 >
 > --- /FreeBSD/FreeBSD-current/src/usr.bin/tftp/main.c	2003-10-11 17:27:55.000000000 -0700
 > +++ main.c	2004-07-19 03:59:11.000000000 -0700
 > @@ -495,6 +495,7 @@
 >  		fd = creat(cp, 0644);
 >  		if (fd < 0) {
 >  			warn("%s", cp);
 > +			free(cp);
 >  			continue;
 >  		}
 >  		if (verbose)
 
 Are you sure this patch is applicable to FreeBSD?  OpenBSD uses
 asprintf(3) in put() that is why they need free(cp) if they fail to
 open(2) but FreeBSD doesn't.  Moreover, your patch is for get().
 Could you please elaborate?
 
 -- 
 Maxim Konovalov
State-Changed-From-To: open->feedback 
State-Changed-By: maxim 
State-Changed-When: Mon Jul 19 15:46:22 GMT 2004 
State-Changed-Why:  
I doubt we have described bug, feedback requested. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69275 
State-Changed-From-To: feedback->closed 
State-Changed-By: maxim 
State-Changed-When: Mon Aug 2 16:07:02 GMT 2004 
State-Changed-Why:  
Feedback timeout + we do not have that bug. 

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