]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Don't leak 'primary' video property on error
authorChristophe Fergeau <cfergeau@redhat.com>
Thu, 21 Feb 2013 15:21:31 +0000 (16:21 +0100)
committerChristophe Fergeau <cfergeau@redhat.com>
Fri, 22 Feb 2013 08:31:19 +0000 (09:31 +0100)
It's only freed on normal returns from virDomainVideoDefParseXML,
but not when erroring out.

src/conf/domain_conf.c

index 10f361c0ceabb24754827d011bf1b5adc09db4b6..258ee93705e6a033fb9918a24e6268ae8d624d78 100644 (file)
@@ -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;