aboutsummaryrefslogtreecommitdiff
path: root/contrib/hyperv
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2014-09-25 22:22:48 +0000
committerXin LI <delphij@FreeBSD.org>2014-09-25 22:22:48 +0000
commit0a8534f083b0ef6712369d449f7c305eb73081dc (patch)
treeeeb366af442e00f7affef28afdbd329e922f59e2 /contrib/hyperv
parentbe930504becc794c808b529bd65fa09d2d85f846 (diff)
downloadsrc-0a8534f083b0ef6712369d449f7c305eb73081dc.tar.gz
src-0a8534f083b0ef6712369d449f7c305eb73081dc.zip
Plug a file descriptor leak.
Reported by: Coverity CID: 1238916 MFC after: 1 week
Notes
Notes: svn path=/head/; revision=272140
Diffstat (limited to 'contrib/hyperv')
-rw-r--r--contrib/hyperv/tools/hv_kvp_daemon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/hyperv/tools/hv_kvp_daemon.c b/contrib/hyperv/tools/hv_kvp_daemon.c
index 6e1acbe9740b..eafc867b0bd0 100644
--- a/contrib/hyperv/tools/hv_kvp_daemon.c
+++ b/contrib/hyperv/tools/hv_kvp_daemon.c
@@ -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);
}