]> git.ipfire.org Git - thirdparty/qemu.git/commit
qcow: fix a reference leak
authorKONRAD Frederic <frederic.konrad@adacore.com>
Wed, 25 Jul 2018 18:07:29 +0000 (20:07 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 31 Jul 2018 16:46:31 +0000 (11:46 -0500)
commitb102aea574939d93b996a01c1aebc49a30e2bb15
tree6c9fba84b3fe37bfa671670825e465cbfb5bd0a3
parent336cd382dcf2e5de6c47a6dd185a3a563655d626
qcow: fix a reference leak

Since 42a3e1ab367cdf38cce093de24eb406b99a4ef96 qemu asserts when using the
vvfat driver:

git clone git://qemu.org/qemu.git
cd qemu
./configure --target-list=ppc-softmmu --enable-debug
make -j8
mkdir foo
touch foo/hello
./ppc-softmmu/qemu-system-ppc -M prep --nographic --monitor null             \
                              -hda fat:rw:./foo

"Ctrl-C"

qemu-system-ppc: block.c:3368: bdrv_close_all: Assertion                     \
   `((&all_bdrv_states)->tqh_first == ((void *)0))' failed.

This is because we reference bs twice in qcow_co_create(..) one time in
bdrv_open_blockdev_ref(..) and in blk_insert_bs(..) but we unref it only once
in blk_unref which leads to the reference leak.

Note that I didn't tested much QCOW after this change as I don't use it much.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 41b6513436d2ebb64c7df8f009f630922a8e8990)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow.c