diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2020-03-16 09:06:31 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2020-03-24 11:41:46 +0100 |
commit | 808cf3cb6af8171b4e24d24f2a2d461434dc6572 (patch) | |
tree | c68de7502940f9af44f13a343a7ba85dae730a3f /block | |
parent | 6e57963a77df1e275a73dab4c6a7ec9a9d3468d4 (diff) | |
download | qemu-808cf3cb6af8171b4e24d24f2a2d461434dc6572.zip qemu-808cf3cb6af8171b4e24d24f2a2d461434dc6572.tar.gz qemu-808cf3cb6af8171b4e24d24f2a2d461434dc6572.tar.bz2 |
block/qcow2: zero data_file child after free
data_file being NULL doesn't seem to be a correct state, but it's
better than dead pointer and simpler to debug.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200316060631.30052-3-vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index e08917e..d1da3d9 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1758,6 +1758,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, g_free(s->image_data_file); if (has_data_file(bs)) { bdrv_unref_child(bs, s->data_file); + s->data_file = NULL; } g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); @@ -2621,6 +2622,7 @@ static void qcow2_close(BlockDriverState *bs) if (has_data_file(bs)) { bdrv_unref_child(bs, s->data_file); + s->data_file = NULL; } qcow2_refcount_close(bs); |