提交 03a43efa 编写于 作者: V Viktor Mihajlovski 提交者: Peter Krempa

libvirt: Increase connection reference count for callbacks

By adjusting the reference count of the connection object we
prevent races between callback function and virConnectClose.
Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
上级 482e5f15
......@@ -20186,6 +20186,8 @@ int virConnectRegisterCloseCallback(virConnectPtr conn,
return -1;
}
virObjectRef(conn);
virMutexLock(&conn->lock);
virCheckNonNullArgGoto(cb, error);
......@@ -20206,6 +20208,7 @@ int virConnectRegisterCloseCallback(virConnectPtr conn,
error:
virMutexUnlock(&conn->lock);
virObjectUnref(conn);
virDispatchError(NULL);
return -1;
}
......@@ -20255,6 +20258,8 @@ int virConnectUnregisterCloseCallback(virConnectPtr conn,
virMutexUnlock(&conn->lock);
virObjectUnref(conn);
return 0;
error:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册