tools/hv: Fix file handle leak
Ben Hutchings [Wed, 5 Sep 2012 21:37:35 +0000 (14:37 -0700)]
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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tools/hv/hv_kvp_daemon.c

index c8e1013..4514fb4 100644 (file)
@@ -160,7 +160,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);
 }
 
@@ -207,6 +207,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)