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>
This commit is contained in:
parent
6e57963a77
commit
808cf3cb6a
@ -1758,6 +1758,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
|
|||||||
g_free(s->image_data_file);
|
g_free(s->image_data_file);
|
||||||
if (has_data_file(bs)) {
|
if (has_data_file(bs)) {
|
||||||
bdrv_unref_child(bs, s->data_file);
|
bdrv_unref_child(bs, s->data_file);
|
||||||
|
s->data_file = NULL;
|
||||||
}
|
}
|
||||||
g_free(s->unknown_header_fields);
|
g_free(s->unknown_header_fields);
|
||||||
cleanup_unknown_header_ext(bs);
|
cleanup_unknown_header_ext(bs);
|
||||||
@ -2621,6 +2622,7 @@ static void qcow2_close(BlockDriverState *bs)
|
|||||||
|
|
||||||
if (has_data_file(bs)) {
|
if (has_data_file(bs)) {
|
||||||
bdrv_unref_child(bs, s->data_file);
|
bdrv_unref_child(bs, s->data_file);
|
||||||
|
s->data_file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
qcow2_refcount_close(bs);
|
qcow2_refcount_close(bs);
|
||||||
|
Loading…
Reference in New Issue
Block a user