From: Theodore Ts'o Date: Sun, 5 Jan 2014 06:12:49 +0000 (-0500) Subject: libext2fs: fix potential memory leak in qcow2_write_raw_image() X-Git-Tag: v1.42.10~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ece2d5884b97270a767c734147148c08656b8595;p=thirdparty%2Fe2fsprogs.git libext2fs: fix potential memory leak in qcow2_write_raw_image() Addresses-Coverity-ID: #1049179 Addresses-Coverity-ID: #1049180 Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c index 547edc02e..c7cdbee89 100644 --- a/lib/ext2fs/qcow2.c +++ b/lib/ext2fs/qcow2.c @@ -235,8 +235,10 @@ int qcow2_write_raw_image(int qcow2_fd, int raw_fd, } /* Resize the output image to the filesystem size */ - if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0) - return errno; + if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0) { + ret = errno; + goto out; + } ((char *)copy_buf)[0] = 0; size = write(raw_fd, copy_buf, 1);