btrfs-progs: fragments, close output file on error

Resolves-Coverity-CID: 1258794
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
master
David Sterba 2014-12-19 16:15:39 +01:00
parent fbd8e04f4b
commit db0981936c
1 changed files with 5 additions and 2 deletions

View File

@ -233,7 +233,7 @@ list_fragments(int fd, u64 flags, char *dir)
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
if (ret < 0) {
fprintf(stderr, "ERROR: can't perform the search\n");
return ret;
goto out_close;
}
/* the ioctl returns the number of item it found in nr_items */
if (sk->nr_items == 0)
@ -373,7 +373,10 @@ skip:;
fprintf(html, "</p>");
}
fprintf(html, "</body></html>\n");
out_close:
fclose(html);
return ret;
}