提交 81b2a8e0 编写于 作者: M Marc Hartmayer 提交者: John Ferlan

test: testConnectClose: Set privateData to NULL in all cases

Set privateData to NULL also for a connection that uses @defaultConn
as privateData regardless of whether @defaultConn was freed or
not. @defaultConn is shared between multiple connections and it's
ensured that there will be no memory leak by counting references.
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 5428389b
...@@ -1472,6 +1472,7 @@ static int testConnectClose(virConnectPtr conn) ...@@ -1472,6 +1472,7 @@ static int testConnectClose(virConnectPtr conn)
dflt = true; dflt = true;
virMutexLock(&defaultLock); virMutexLock(&defaultLock);
if (--defaultConnections) { if (--defaultConnections) {
conn->privateData = NULL;
virMutexUnlock(&defaultLock); virMutexUnlock(&defaultLock);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册