提交 f27490b7 编写于 作者: D Daniel P. Berrange

Fix crash if OOM occurs when creating virConnectPtr

If a OOM error occurs in virGetConnect, this may cause the
virConnectDispose method to de-reference a NULL pointer,
since the close callback will not have been initialized.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 182d5ed3
......@@ -164,11 +164,13 @@ virConnectDispose(void *obj)
virURIFree(conn->uri);
virObjectLock(conn->closeCallback);
conn->closeCallback->callback = NULL;
virObjectUnlock(conn->closeCallback);
if (conn->closeCallback) {
virObjectLock(conn->closeCallback);
conn->closeCallback->callback = NULL;
virObjectUnlock(conn->closeCallback);
virObjectUnref(conn->closeCallback);
virObjectUnref(conn->closeCallback);
}
virMutexUnlock(&conn->lock);
virMutexDestroy(&conn->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册