mirror of https://github.com/xemu-project/xemu.git
qcow2: fix null pointer dereference
It seems this assert() was somehow misplaced. block/qcow2-refcount.c:2193:42: warning: Array access (from variable 'on_disk_reftable') results in a null pointer dereference on_disk_reftable[refblock_index] = refblock_offset; ~~~~~~~~~~~~~~~~ ^ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
b7b1e9dd6d
commit
f80ac75d0e
|
@ -2189,6 +2189,8 @@ write_refblocks:
|
||||||
* this will leak that range, but we can easily fix that by running
|
* this will leak that range, but we can easily fix that by running
|
||||||
* a leak-fixing check after this rebuild operation */
|
* a leak-fixing check after this rebuild operation */
|
||||||
reftable_offset = -1;
|
reftable_offset = -1;
|
||||||
|
} else {
|
||||||
|
assert(on_disk_reftable);
|
||||||
}
|
}
|
||||||
on_disk_reftable[refblock_index] = refblock_offset;
|
on_disk_reftable[refblock_index] = refblock_offset;
|
||||||
|
|
||||||
|
@ -2258,8 +2260,6 @@ write_refblocks:
|
||||||
goto write_refblocks;
|
goto write_refblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(on_disk_reftable);
|
|
||||||
|
|
||||||
for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) {
|
for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) {
|
||||||
cpu_to_be64s(&on_disk_reftable[refblock_index]);
|
cpu_to_be64s(&on_disk_reftable[refblock_index]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue