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:
Peter Krempa 2015-06-18 11:37:17 +02:00
parent 0c151004bc
commit 4002395dd7
1 changed files with 1 additions and 1 deletions

View File

@ -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);