On 3/25/22 16:02, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/datatypes.c | 63 +++++++++++++++----------------------------------
1 file changed, 19 insertions(+), 44 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index aa614612f9..da8a9970f1 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
int
@@ -1173,14 +1153,12 @@
virAdmConnectCloseCallbackDataRegister(virAdmConnectCloseCallbackData *cbdata,
void *opaque,
virFreeCallback freecb)
{
- int ret = -1;
-
- virObjectLock(cbdata);
Here, @cbdata used to be locked ...
+ VIR_LOCK_GUARD lock = virObjectLockGuard(cbdata);
if (cbdata->callback) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("A close callback is already registered"));
- goto cleanup;
+ return -1;
}
cbdata->conn = virObjectRef(conn);
@@ -1188,10 +1166,7 @@
virAdmConnectCloseCallbackDataRegister(virAdmConnectCloseCallbackData *cbdata,
cbdata->opaque = opaque;
cbdata->freeCallback = freecb;
- ret = 0;
- cleanup:
- virObjectUnlock(conn->closeCallback);
... but ere conn->closeCallback was unlocked. I believe your change is
correct and in fact fixes this problem. But can't really verify because
this function is never called.
- return ret;
+ return 0;
}
virAdmServerPtr
Michal