From nobody@FreeBSD.org  Mon Aug 31 09:15:14 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4C7881065679
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 09:15:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B4588FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 09:15:14 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7V9FDrY002622
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 09:15:13 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n7V9FDm8002621;
	Mon, 31 Aug 2009 09:15:13 GMT
	(envelope-from nobody)
Message-Id: <200908310915.n7V9FDm8002621@www.freebsd.org>
Date: Mon, 31 Aug 2009 09:15:13 GMT
From: Patroklos Argyroudis <argp@census-labs.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Resource leak in command_help() in file sys/boot/common/commands.c
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         138374
>Category:       kern
>Synopsis:       [boot] [patch] Resource leak in command_help() in file sys/boot/common/commands.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brueffer
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 31 09:20:03 UTC 2009
>Closed-Date:    Wed Nov 04 14:21:00 CET 2009
>Last-Modified:  Wed Nov 04 14:21:00 CET 2009
>Originator:     Patroklos Argyroudis
>Release:        8.0-CURRENT
>Organization:
census, inc
>Environment:
N/A
>Description:
In function command_help() in file sys/boot/common/commands.c there is a resource leak of file descriptor hfd.  Although the file descriptor is initialized in line 135, it is not closed.
>How-To-Repeat:
N/A
>Fix:
Patch attached.

Patch attached with submission follows:

--- ./sys/boot/common/commands.c.orig	2009-08-27 16:11:44.000000000 +0300
+++ ./sys/boot/common/commands.c	2009-08-27 16:22:06.000000000 +0300
@@ -150,6 +150,7 @@
 	break;
     default:
 	command_errmsg = "usage is 'help <topic> [<subtopic>]";
+	close(hfd);
 	return(CMD_ERROR);
     }
 


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: brueffer 
State-Changed-When: Wed Oct 28 11:06:36 CET 2009 
State-Changed-Why:  
Committed, thanks! 


Responsible-Changed-From-To: freebsd-bugs->brueffer 
Responsible-Changed-By: brueffer 
Responsible-Changed-When: Wed Oct 28 11:06:36 CET 2009 
Responsible-Changed-Why:  
MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138374 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/138374: commit references a PR
Date: Wed, 28 Oct 2009 10:06:38 +0000 (UTC)

 Author: brueffer
 Date: Wed Oct 28 10:06:27 2009
 New Revision: 198537
 URL: http://svn.freebsd.org/changeset/base/198537
 
 Log:
   Close a file descriptor leak in an error case.
   
   PR:		138374
   Submitted by:	Patroklos Argyroudis <argp@census-labs.com>
   MFC after:	1 week
 
 Modified:
   head/sys/boot/common/commands.c
 
 Modified: head/sys/boot/common/commands.c
 ==============================================================================
 --- head/sys/boot/common/commands.c	Wed Oct 28 09:55:42 2009	(r198536)
 +++ head/sys/boot/common/commands.c	Wed Oct 28 10:06:27 2009	(r198537)
 @@ -150,6 +150,7 @@ command_help(int argc, char *argv[]) 
  	break;
      default:
  	command_errmsg = "usage is 'help <topic> [<subtopic>]";
 +	close(hfd);
  	return(CMD_ERROR);
      }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: brueffer 
State-Changed-When: Wed Nov 4 14:20:44 CET 2009 
State-Changed-Why:  
MFCs done. 

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