mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virfirewall: Fir a memleak in virFirewallParseXML()
As a part of parsing XML, virFirewallParseXML() calls virXMLNodeContentString() and then passes the return value further. But virXMLNodeContentString() is documented so that it's the caller's responsibility to free the returned string, which virFirewallParseXML() never does. This leads to a memory leak: 14,300 bytes in 220 blocks are definitely lost in loss record 1,879 of 1,891 at 0x4841858: malloc (vg_replace_malloc.c:442) by 0x5491E3C: xmlBufCreateSize (in /usr/lib64/libxml2.so.2.12.6) by 0x54C2401: xmlNodeGetContent (in /usr/lib64/libxml2.so.2.12.6) by 0x49F7791: virXMLNodeContentString (virxml.c:354) by 0x4979F25: virFirewallParseXML (virfirewall.c:1134) by 0x4ABEB1E: virNetworkLoadState (virnetworkobj.c:938) by 0x4ABF35C: virNetworkObjLoadAllState (virnetworkobj.c:1072) by 0x4E9A25E: networkStateInitialize (bridge_driver.c:624) by 0x4CB1FA6: virStateInitialize (libvirt.c:665) by 0x15A6C6: daemonRunStateInit (remote_daemon.c:611) by 0x49E69F0: virThreadHelper (virthread.c:256) by 0x532B428: start_thread (in /lib64/libc.so.6) Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3f589def04
commit
be1e745cd2
@ -1137,7 +1137,7 @@ virFirewallParseXML(virFirewall **firewall,
|
|||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
for (i = 0; i < nargs; i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
|
|
||||||
char *arg = virXMLNodeContentString(argsNodes[i]);
|
g_autofree char *arg = virXMLNodeContentString(argsNodes[i]);
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user