diff mbox

[07/16] btrfs-progs: don't leak buffer on add_file_items() error

Message ID 1383779755-18228-8-git-send-email-sandeen@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Nov. 6, 2013, 11:15 p.m. UTC
add_file_items() leaked "buffer" on this error return.
Free it first.

Resolves-Coverity-CID: 1125937
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 mkfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/mkfs.c b/mkfs.c
index d576797..f29f5cd 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -629,6 +629,7 @@  static int add_file_items(struct btrfs_trans_handle *trans,
 		ret_read = pread64(fd, buffer, st->st_size, bytes_read);
 		if (ret_read == -1) {
 			fprintf(stderr, "%s read failed\n", path_name);
+			free(buffer);
 			goto end;
 		}