---
src/qemu/qemu_conf.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 094f9f7..d616d7a 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1466,6 +1466,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
virStoragePoolPtr pool = NULL;
virStorageVolPtr vol = NULL;
virStorageVolInfo info;
+ virErrorPtr orig_err = NULL;
int ret = -1;
if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
@@ -1475,7 +1476,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
return 0;
if (!(pool = virStoragePoolLookupByName(conn, def->srcpool->pool)))
- return -1;
+ goto cleanup;
if (!(vol = virStorageVolLookupByName(pool, def->srcpool->volume)))
goto cleanup;
@@ -1506,7 +1507,15 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
def->srcpool->voltype = info.type;
ret = 0;
cleanup:
+ if (ret < 0 && !orig_err)
+ orig_err = virSaveLastError();
+
virStoragePoolFree(pool);
virStorageVolFree(vol);
+
+ if (orig_err) {
+ virSetError(orig_err);
+ virFreeError(orig_err);
+ }
return ret;
}
--
1.8.1.4