From: David Sterba Date: Fri, 19 Dec 2014 15:15:39 +0000 (+0100) Subject: btrfs-progs: fragments, close output file on error X-Git-Tag: upstream/4.16.1~2501 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db0981936c945af4b3089aa8ed9981c075dca721;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: fragments, close output file on error Resolves-Coverity-CID: 1258794 Reviewed-by: Eric Sandeen Signed-off-by: David Sterba --- diff --git a/btrfs-fragments.c b/btrfs-fragments.c index d03c2c3..360f10f 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c @@ -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, "

"); } fprintf(html, "\n"); - + +out_close: + fclose(html); + return ret; }