We need to free the string returned by gvir_config_object_to_xml() after
using it.

Signed-off-by: Christophe Fergeau <cferg...@redhat.com>
---
 libvirt-gobject/libvirt-gobject-connection.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c 
b/libvirt-gobject/libvirt-gobject-connection.c
index c48d51b9..15b47093 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -1999,7 +1999,7 @@ GVirStoragePool *gvir_connection_create_storage_pool
                                  GVirConfigStoragePool *conf,
                                  guint flags,
                                  GError **err) {
-    const gchar *xml;
+    gchar *xml;
     virStoragePoolPtr handle;
     GVirConnectionPrivate *priv;
 
@@ -2012,7 +2012,9 @@ GVirStoragePool *gvir_connection_create_storage_pool
     g_return_val_if_fail(xml != NULL, NULL);
 
     priv = conn->priv;
-    if (!(handle = virStoragePoolDefineXML(priv->conn, xml, flags))) {
+    handle = virStoragePoolDefineXML(priv->conn, xml, flags);
+    g_free(xml);
+    if (!handle) {
         gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
                                flags,
                                _("Failed to create storage pool"));
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to