提交 82fa7fc3 编写于 作者: J John Ferlan

lockd: Need to Unref @srv when done with it.

Commit id '252610f7' used a hash table to store the @srv, but
didn't handle the virObjectUnref if virNetDaemonNew failed nor
did it use virObjectUnref once successfully placed into the table
which will now be managing it's lifetime (and would cause the
virObjectRef if successfully inserted into the table).
上级 bce925da
...@@ -173,6 +173,8 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) ...@@ -173,6 +173,8 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
if (!(lockd->dmn = virNetDaemonNew()) || if (!(lockd->dmn = virNetDaemonNew()) ||
virNetDaemonAddServer(lockd->dmn, srv) < 0) virNetDaemonAddServer(lockd->dmn, srv) < 0)
goto error; goto error;
virObjectUnref(srv);
srv = NULL;
if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES, if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES,
virLockDaemonLockSpaceDataFree))) virLockDaemonLockSpaceDataFree)))
...@@ -184,6 +186,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) ...@@ -184,6 +186,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
return lockd; return lockd;
error: error:
virObjectUnref(srv);
virLockDaemonFree(lockd); virLockDaemonFree(lockd);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册