OSDN Git Service

Fix clang warnings and leak of full_stats_file .
authorChih-Hung Hsieh <chh@google.com>
Fri, 12 Feb 2016 19:32:33 +0000 (11:32 -0800)
committerChih-Hung Hsieh <chh@google.com>
Fri, 12 Feb 2016 19:36:07 +0000 (11:36 -0800)
BUG: 27121040
Change-Id: I33a218c7746509278e1222cd5dbd6d4876405b28

tests/ext4/rand_emmc_perf.c

index ebd10c8..fed7a54 100644 (file)
@@ -51,8 +51,8 @@ static void print_stats(struct stats *stats_buf, int stats_count,
 {
     int i;
     struct timeval t;
-    struct timeval sum = { 0 };
-    struct timeval max = { 0 };
+    struct timeval sum = { 0, 0 };
+    struct timeval max = { 0, 0 };
     long long total_usecs;
     long long avg_usecs;
     long long max_usecs;
@@ -217,6 +217,7 @@ int main(int argc, char *argv[])
             break;
 
           case 'f':
+            free(full_stats_file);
             full_stats_file = strdup(optarg);
             if (full_stats_file == NULL) {
                 fprintf(stderr, "Cannot get full stats filename\n");
@@ -258,6 +259,7 @@ int main(int argc, char *argv[])
     } else {
         perf_test(fd, write_mode, max_blocks);
     }
+    free(full_stats_file);
 
     exit(0);
 }