Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 16 ++++++++++++----
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc3bc22..801dcf8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1228,10 +1228,20 @@ virDomainGraphicsListenDefClear(virDomainGraphicsListenDefPtr
def)
}
-void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
+void
+virDomainGraphicsListenClear(virDomainGraphicsDefPtr def)
{
size_t i;
+ for (i = 0; i < def->nListens; i++)
+ virDomainGraphicsListenDefClear(&def->listens[i]);
+ VIR_FREE(def->listens);
+ def->nListens = 0;
+}
+
+
+void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
+{
if (!def)
return;
@@ -1263,9 +1273,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
break;
}
- for (i = 0; i < def->nListens; i++)
- virDomainGraphicsListenDefClear(&def->listens[i]);
- VIR_FREE(def->listens);
+ virDomainGraphicsListenClear(def);
VIR_FREE(def);
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a96a130..c5aa58d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2813,6 +2813,7 @@ int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr
match,
virDomainGraphicsListenDefPtr
virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
+void virDomainGraphicsListenClear(virDomainGraphicsDefPtr def);
int virDomainGraphicsListenAddAddress(virDomainGraphicsDefPtr def,
int pos,
const char *address)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f864f78..85f1e0a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -303,6 +303,7 @@ virDomainGraphicsDefFree;
virDomainGraphicsGetListen;
virDomainGraphicsListenAddAddress;
virDomainGraphicsListenAddNetwork;
+virDomainGraphicsListenClear;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeToString;
virDomainGraphicsSpiceChannelNameTypeFromString;
--
2.7.4