diff options
author | Tomas Hozza <thozza@redhat.com> | 2013-05-22 14:54:33 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-03 14:13:09 -0700 |
commit | fca597558e47f936a0e03bab15af726aa3a0fa0e (patch) | |
tree | beadcfb08e0983eb3c391cd3d87a860eadec3243 /tools/hv | |
parent | f14e600a3bb62905fe9e4e0350048af4ead54ca9 (diff) | |
download | linux-fca597558e47f936a0e03bab15af726aa3a0fa0e.tar.gz linux-fca597558e47f936a0e03bab15af726aa3a0fa0e.tar.bz2 linux-fca597558e47f936a0e03bab15af726aa3a0fa0e.zip |
tools: hv: Fix file descriptor leaks
Close "fd" file descriptor when is goes out of scope so it does
not leak.
Signed-off-by: Tomas Hozza <thozza@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv')
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 5b8f28f2aafa..d55ce4040b74 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -257,12 +257,15 @@ static int kvp_file_init(void) filep = fopen(fname, "re"); - if (!filep) + if (!filep) { + close(fd); return 1; + } record = malloc(alloc_unit * num_blocks); if (record == NULL) { fclose(filep); + close(fd); return 1; } for (;;) { @@ -286,6 +289,7 @@ static int kvp_file_init(void) num_blocks); if (record == NULL) { fclose(filep); + close(fd); return 1; } continue; |