Close leaking fd if ioctl fails. Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> --- tools/kvm/disk-image.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/kvm/disk-image.c b/tools/kvm/disk-image.c index 252ff1c..0fb2083 100644 --- a/tools/kvm/disk-image.c +++ b/tools/kvm/disk-image.c @@ -120,8 +120,10 @@ static struct disk_image *blkdev__probe(const char *filename, struct stat *st) if (fd < 0) return NULL; - if (ioctl(fd, BLKGETSIZE64, &size) < 0) + if (ioctl(fd, BLKGETSIZE64, &size) < 0) { + close(fd); return NULL; + } return disk_image__new_readonly(fd, size, &raw_image_ro_mmap_ops); } -- 1.7.5.rc1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html