Commit id '5f2a132786' should have placed the data in the host source
def structure since that's also used by smartcard, redirdev, and rng in
order to provide a backend tcp channel. The data in the private structure
will be necessary in order to provide the secret properly
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/domain_conf.c | 17 +++++++----------
src/conf/domain_conf.h | 2 +-
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2b89ea2..a684c48 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2024,6 +2024,7 @@ void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def)
return;
virDomainChrSourceDefClear(def);
+ virObjectUnref(def->privateData);
VIR_FREE(def);
}
@@ -2125,8 +2126,6 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
VIR_FREE(def->seclabels);
}
- virObjectUnref(def->privateData);
-
VIR_FREE(def);
}
@@ -10318,13 +10317,17 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
static virDomainChrSourceDefPtr
-virDomainChrSourceDefNew(void)
+virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt)
{
virDomainChrSourceDefPtr def = NULL;
if (VIR_ALLOC(def) < 0)
return NULL;
+ if (xmlopt && xmlopt->privateData.chardevNew &&
+ !(def->privateData = xmlopt->privateData.chardevNew()))
+ VIR_FREE(def);
+
return def;
}
@@ -10342,15 +10345,9 @@ virDomainChrDefNew(virDomainXMLOptionPtr xmlopt)
def->target.port = -1;
- if (!(def->source = virDomainChrSourceDefNew()))
+ if (!(def->source = virDomainChrSourceDefNew(xmlopt)))
VIR_FREE(def);
- if (xmlopt && xmlopt->privateData.chardevNew &&
- !(def->privateData = xmlopt->privateData.chardevNew())) {
- virDomainChrSourceDefFree(def->source);
- VIR_FREE(def);
- }
-
return def;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 5247d34..97ffcf4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1078,6 +1078,7 @@ typedef enum {
/* The host side information for a character device. */
struct _virDomainChrSourceDef {
int type; /* virDomainChrType */
+ virObjectPtr privateData;
union {
/* no <source> for null, vc, stdio */
struct {
@@ -1117,7 +1118,6 @@ struct _virDomainChrSourceDef {
/* A complete character device, both host and domain views. */
struct _virDomainChrDef {
int deviceType; /* enum virDomainChrDeviceType */
- virObjectPtr privateData;
bool targetTypeAttr;
int targetType; /* enum virDomainChrConsoleTargetType ||
--
2.7.4