mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Avoid NULL dereference in qemuSharedDiskEntryFree
At least one caller may call qemuSharedDiskEntryFree with NULL as the first argument. Let's make the function similar to other *Free functions and do nothing in such case.
This commit is contained in:
parent
11677e081b
commit
57bb725aca
@ -1045,6 +1045,9 @@ qemuSharedDiskEntryFree(void *payload, const void *name ATTRIBUTE_UNUSED)
|
|||||||
qemuSharedDiskEntryPtr entry = payload;
|
qemuSharedDiskEntryPtr entry = payload;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (!entry)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < entry->ref; i++) {
|
for (i = 0; i < entry->ref; i++) {
|
||||||
VIR_FREE(entry->domains[i]);
|
VIR_FREE(entry->domains[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user