[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/2] conf: Don't leak 'primary' video property on error



It's only freed on normal returns from virDomainVideoDefParseXML,
but not when erroring out.
---
 src/conf/domain_conf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 10f361c..258ee93 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7662,9 +7662,11 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
                 vram = virXMLPropString(cur, "vram");
                 heads = virXMLPropString(cur, "heads");
 
-                if ((primary = virXMLPropString(cur, "primary")) != NULL)
+                if ((primary = virXMLPropString(cur, "primary")) != NULL) {
                     if (STREQ(primary, "yes"))
                         def->primary = 1;
+                    VIR_FREE(primary);
+                }
 
                 def->accel = virDomainVideoAccelDefParseXML(cur);
             }
@@ -7728,7 +7730,6 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
     VIR_FREE(ram);
     VIR_FREE(vram);
     VIR_FREE(heads);
-    VIR_FREE(primary);
 
     return def;
 
-- 
1.8.1.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]