mkfs.btrfs: free buffers allocated by pretty_sizes

found by valgrind:
==2559== 16 bytes in 1 blocks are definitely lost in loss record 3 of 19
==2559==    at 0x4C2720E: malloc (vg_replace_malloc.c:236)
==2559==    by 0x412F7E: pretty_sizes (utils.c:1054)
==2559==    by 0x4179E9: main (mkfs.c:1395)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
This commit is contained in:
Sergei Trofimovich 2011-06-04 11:19:22 +03:00 committed by Chris Mason
parent 8e4b7e883a
commit e06947319c
1 changed files with 3 additions and 1 deletions

4
mkfs.c
View File

@ -1175,6 +1175,7 @@ int main(int ac, char **av)
char *output = "output.img"; char *output = "output.img";
u64 num_of_meta_chunks = 0; u64 num_of_meta_chunks = 0;
u64 size_of_data = 0; u64 size_of_data = 0;
char *pretty_buf;
while(1) { while(1) {
int c; int c;
@ -1392,7 +1393,8 @@ raid_groups:
printf("fs created label %s on %s\n\tnodesize %u leafsize %u " printf("fs created label %s on %s\n\tnodesize %u leafsize %u "
"sectorsize %u size %s\n", "sectorsize %u size %s\n",
label, first_file, nodesize, leafsize, sectorsize, label, first_file, nodesize, leafsize, sectorsize,
pretty_sizes(btrfs_super_total_bytes(&root->fs_info->super_copy))); pretty_buf = pretty_sizes(btrfs_super_total_bytes(&root->fs_info->super_copy)));
free(pretty_buf);
printf("%s\n", BTRFS_BUILD_VERSION); printf("%s\n", BTRFS_BUILD_VERSION);
btrfs_commit_transaction(trans, root); btrfs_commit_transaction(trans, root);