]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix leak of char device in xenParseXM
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Sep 2013 15:44:26 +0000 (16:44 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:49:28 +0000 (15:49 +0100)
If an OOM occurs in xenParseXM, a virDomainChrDef may be
leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/xenxs/xen_xm.c

index 1ffea8469c92b5cb3006e165bfd806349f138778..4386fefa67a02721d138c8d95b8f78f7a20575dd 100644 (file)
@@ -1080,8 +1080,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
                 if (!(chr = xenParseSxprChar(port, NULL)))
                     goto cleanup;
 
-                if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0)
+                if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
+                    virDomainChrDefFree(chr);
                     goto cleanup;
+                }
 
                 chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
                 chr->target.port = portnum;