]> git.cworth.org Git - fips/commitdiff
Close two memory leaks in fips metrics reporting.
authorCarl Worth <cworth@cworth.org>
Wed, 23 Oct 2013 00:43:31 +0000 (17:43 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 23 Oct 2013 00:43:31 +0000 (17:43 -0700)
Thanks to valgrind for pointing these out.

metrics.c

index f1f44287342574b7d41769ea0be6c346bedd40b9..38e9e954a6fc7dc941ce4bb608d76d1e886a4a32 100644 (file)
--- a/metrics.c
+++ b/metrics.c
@@ -489,6 +489,8 @@ print_program_metrics (void)
 
        for (i = 0; i < ctx->num_op_metrics; i++)
                print_op_metrics (ctx, &ctx->op_metrics[sorted[i]], total);
+
+       free (sorted);
 }
 
 /* Called at program exit */
@@ -574,6 +576,8 @@ metrics_end_frame (void)
 
                accumulate_program_metrics (monitor->op, result, result_size);
 
+               free (result);
+
                current_context.monitor_head = monitor->next;
                if (current_context.monitor_head == NULL)
                        current_context.monitor_tail = NULL;