Bug 138374 - [boot] [patch] Resource leak in command_help() in file sys/boot/common/commands.c
Summary: [boot] [patch] Resource leak in command_help() in file sys/boot/common/comman...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Christian Brueffer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-31 10:20 UTC by Patroklos Argyroudis
Modified: 2009-11-04 13:21 UTC (History)
0 users

See Also:


Attachments
file.diff (285 bytes, patch)
2009-08-31 10:20 UTC, Patroklos Argyroudis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patroklos Argyroudis 2009-08-31 10:20:03 UTC
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.

Fix: Patch attached.

Patch attached with submission follows:
How-To-Repeat: N/A
Comment 1 Christian Brueffer freebsd_committer freebsd_triage 2009-10-28 10:06:36 UTC
State Changed
From-To: open->patched

Committed, thanks! 


Comment 2 Christian Brueffer freebsd_committer freebsd_triage 2009-10-28 10:06:36 UTC
Responsible Changed
From-To: freebsd-bugs->brueffer

MFC reminder.
Comment 3 dfilter service freebsd_committer freebsd_triage 2009-10-28 10:06:38 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"
Comment 4 Christian Brueffer freebsd_committer freebsd_triage 2009-11-04 13:20:44 UTC
State Changed
From-To: patched->closed

MFCs done.