Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 22:22:49 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272140 - head/contrib/hyperv/tools
Message-ID:  <201409252222.s8PMMnvg036232@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Sep 25 22:22:48 2014
New Revision: 272140
URL: http://svnweb.freebsd.org/changeset/base/272140

Log:
  Plug a file descriptor leak.
  
  Reported by:	Coverity
  CID:		1238916
  MFC after:	1 week

Modified:
  head/contrib/hyperv/tools/hv_kvp_daemon.c

Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c
==============================================================================
--- head/contrib/hyperv/tools/hv_kvp_daemon.c	Thu Sep 25 22:22:43 2014	(r272139)
+++ head/contrib/hyperv/tools/hv_kvp_daemon.c	Thu Sep 25 22:22:48 2014	(r272140)
@@ -305,11 +305,13 @@ kvp_file_init(void)
 
 		filep = fopen(fname, "r");
 		if (!filep) {
+			close(fd);
 			return (1);
 		}
 
 		record = malloc(alloc_unit * num_blocks);
 		if (record == NULL) {
+			close(fd);
 			fclose(filep);
 			return (1);
 		}
@@ -334,6 +336,7 @@ kvp_file_init(void)
 				record = realloc(record, alloc_unit *
 					num_blocks);
 				if (record == NULL) {
+					close(fd);
 					fclose(filep);
 					return (1);
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409252222.s8PMMnvg036232>