libext2fs: fix potential memory leak in qcow2_write_raw_image()

Addresses-Coverity-ID: #1049179
Addresses-Coverity-ID: #1049180

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
maint-test
Theodore Ts'o 2014-01-05 01:12:49 -05:00 committed by Theodore Ts'o
parent 191a03ac5f
commit ece2d5884b
1 changed files with 4 additions and 2 deletions

View File

@ -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);