[PATCH 3/6] btrfs-progs: fragments, close output file on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves-Coverity-CID: 1258794
Signed-off-by: David Sterba <dsterba@xxxxxxx>
---
 btrfs-fragments.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/btrfs-fragments.c b/btrfs-fragments.c
index d03c2c3e7319..360f10f87bfa 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, "</p>");
 	}
 	fprintf(html, "</body></html>\n");
-	
+
+out_close:
+	fclose(html);
+
 	return ret;
 }
 
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux