mirror of https://gitee.com/openkylin/libvirt.git
rpc: Actually increase reference count on @srv in virNetDaemonAddServer
VIR_APPEND_ELEMENT would clear @srv to NULL after it successfully inserted it thus the reference count could not be increased afterwards. Switch to VIR_APPEND_ELEMENT_COPY. This fixes crash after terminating the daemon.
This commit is contained in:
parent
0c151004bc
commit
4002395dd7
|
@ -162,7 +162,7 @@ virNetDaemonAddServer(virNetDaemonPtr dmn, virNetServerPtr srv)
|
|||
|
||||
virObjectLock(dmn);
|
||||
|
||||
if (VIR_APPEND_ELEMENT(dmn->servers, dmn->nservers, srv) < 0)
|
||||
if (VIR_APPEND_ELEMENT_COPY(dmn->servers, dmn->nservers, srv) < 0)
|
||||
goto cleanup;
|
||||
|
||||
virObjectRef(srv);
|
||||
|
|
Loading…
Reference in New Issue