]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_domain: Drop needless free from qemuDomainObjPrivateXMLParse()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 11 May 2022 14:37:50 +0000 (16:37 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 12 May 2022 06:50:54 +0000 (08:50 +0200)
The qemuDomainObjPrivateXMLParse() is responsible for parsing
given XML into qemuDomainObjPrivate struct. As it does so, memory
might be allocated for some members. If an error occurs during
parsing the control jumps onto 'error' label where only some of
previously allocated memory is freed. The reason there's no
memory leak is simple: the only caller (virDomainObjParseXML())
unrefs freshly created virDomainObj which in turn causes
qemuDomainObjPrivateFree() to be called. Therefore, these
partial, selective frees are needless and should be just dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_domain.c

index 9fabca22891ed14ff184731c4c53eeee81a2e464..df9a9b5651ac2ed3f2990c29bd88e48dd8bfc410 100644 (file)
@@ -3118,9 +3118,6 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
     return 0;
 
  error:
-    g_clear_pointer(&priv->namespaces, virBitmapFree);
-    g_clear_pointer(&priv->monConfig, virObjectUnref);
-    g_clear_pointer(&priv->qemuDevices, g_strfreev);
     return -1;
 }