]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tools/hv: Fix file handle leak
authorBen Hutchings <ben@decadent.org.uk>
Wed, 5 Sep 2012 21:37:35 +0000 (14:37 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Oct 2012 15:35:53 +0000 (08:35 -0700)
commit d5ab482799e7c4c4b7c0aa67e8710dce28115d03 upstream.

Match up each fopen() with an fclose().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/hv/hv_kvp_daemon.c

index d9834b36294373f88d29731350ccc9d384b41788..a08213b2250b5e595dc5ab718188a860f1fc53dd 100644 (file)
@@ -144,7 +144,7 @@ static void kvp_update_file(int pool)
                                sizeof(struct kvp_record),
                                kvp_file_info[pool].num_records, filep);
 
-       fflush(filep);
+       fclose(filep);
        kvp_release_lock(pool);
 }
 
@@ -191,6 +191,7 @@ static void kvp_update_mem_state(int pool)
        kvp_file_info[pool].records = record;
        kvp_file_info[pool].num_records = records_read;
 
+       fclose(filep);
        kvp_release_lock(pool);
 }
 static int kvp_file_init(void)