summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vioqcow2.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2018-10-01 17:34:57 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2018-10-01 17:34:57 +0000
commit3f741288a37c81dec92ad20a8b8477f650326456 (patch)
tree189affbcf9c4d8c56bf48149127c706a38f23f46 /usr.sbin/vmd/vioqcow2.c
parent2057d54c03ce409587b856ca233d12d2e5deebbb (diff)
Fix potential double-free in error path
qc2_open() calls qc2_close() on error which already frees diskp. OK ccardenas@
Diffstat (limited to 'usr.sbin/vmd/vioqcow2.c')
-rw-r--r--usr.sbin/vmd/vioqcow2.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/usr.sbin/vmd/vioqcow2.c b/usr.sbin/vmd/vioqcow2.c
index ceb95fe37c4..c3211d186fa 100644
--- a/usr.sbin/vmd/vioqcow2.c
+++ b/usr.sbin/vmd/vioqcow2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioqcow2.c,v 1.6 2018/10/01 09:31:15 reyk Exp $ */
+/* $OpenBSD: vioqcow2.c,v 1.7 2018/10/01 17:34:56 reyk Exp $ */
/*
* Copyright (c) 2018 Ori Bernstein <ori@eigenstate.org>
@@ -127,7 +127,6 @@ virtio_init_qcow2(struct virtio_backing *file, off_t *szp, int fd)
return -1;
if (qc2_open(diskp, fd) == -1) {
log_warnx("%s: could not open qcow2 disk", __func__);
- free(diskp);
return -1;
}
file->p = diskp;