diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index be1490e44637ca867911d8e9b8d0ce075cf4271d..f8ab545c1f07eec520818617342687cc9cca4c21 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4389,7 +4389,6 @@ static int qemudDomainCoreDump(virDomainPtr dom,
 
     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
-    qemuDriverUnlock(driver);
 
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -4400,7 +4399,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
     }
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJob(vm) < 0)
+    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -4498,6 +4497,7 @@ cleanup:
         virDomainObjUnlock(vm);
     if (event)
         qemuDomainEventQueue(driver, event);
+    qemuDriverUnlock(driver);
     return ret;
 }