mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 08:35:22 +00:00
network: Set to NULL after virNetworkDefFree()
which frees all allocated memory but doesn't set the passed pointer to
NULL. Therefore, we must do it ourselves. This is causing actual
libvirtd crash: Basically, when doing 'virsh net-edit' the newDef should
be dropped. And the memory is freed, indeed. However, the pointer is
not set to NULL but kept instead. And the next duo of calls 'virsh
net-start' and 'virsh net-destroy' starts the disaster. The latter one
does the same as 'virsh destroy'; it sees that newDef is nonNULL so it
replaces def with newDef (which has been freed already as said a few
lines above). Therefore any subsequent call accessing def will hit the ground.
(cherry picked from commit b7e9202401
)
This commit is contained in:
parent
4c2a38d1ed
commit
ec08a738e8
@ -260,8 +260,9 @@ virNetworkObjAssignDef(virNetworkObjPtr network,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (!live) {
|
} else if (!live) {
|
||||||
virNetworkDefFree(network->newDef); /* should be unnecessary */
|
virNetworkDefFree(network->newDef);
|
||||||
virNetworkDefFree(network->def);
|
virNetworkDefFree(network->def);
|
||||||
|
network->newDef = NULL;
|
||||||
network->def = def;
|
network->def = def;
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
|
Loading…
Reference in New Issue
Block a user