On 06/27/2014 05:11 PM, John Ferlan wrote:
Replace the inline "auth" struct in virStorageSource with a
pointer
to a virStorageAuthDefPtr and utilize between the domain_conf, qemu_conf,
and qemu_command sources for finding the auth data for a domain disk
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_conf.c | 106 +++++++---------------------------------------
src/libvirt_private.syms | 1 -
src/qemu/qemu_command.c | 72 +++++++++++++++++++++----------
src/qemu/qemu_conf.c | 26 +++++++-----
src/util/virstoragefile.c | 14 +-----
src/util/virstoragefile.h | 10 +----
tests/qemuargv2xmltest.c | 1 -
7 files changed, 81 insertions(+), 149 deletions(-)
@@ -2650,6 +2663,7 @@ static int
qemuParseRBDString(virDomainDiskDefPtr disk)
error:
VIR_FREE(options);
+ virStorageAuthDefFree(disk->src->auth);
This causes a double free - both callers free disk on failure.
return -1;
}
@@ -2738,6 +2767,7 @@ qemuParseDriveURIString(virDomainDiskDefPtr
def, virURIPtr uri,
error:
virStorageNetHostDefClear(def->src->hosts);
VIR_FREE(def->src->hosts);
+ VIR_FREE(def->src->auth);
This should be freed by the callers too. (by StorageAuthDefFree)
goto cleanup;
}
@@ -1802,7 +1790,7 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->timestamps);
virStorageNetHostDefFree(def->nhosts, def->hosts);
- virStorageSourceAuthClear(def);
+ virStorageAuthDefFree(def->auth);
I don't like *Clear functions leaving pointers to freed memory behind, but
this one is only called right before freeing the StorageSource and it already
leaves def->hosts.
virStorageSourceBackingStoreClear(def);
}
Jan