]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix leak of serial value in xenFormatXM on OOM
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Sep 2013 15:46:44 +0000 (16:46 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:49:28 +0000 (15:49 +0100)
If an OOM occurs in xenFormatXM when formatting to the
serial device value, the value is leaked.

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

index 7550a07abc4262a77055b1bf8a724045ce8d3ba7..9e07f956d297b19ca38f3c5e9e7f68f4d5787b18 100644 (file)
@@ -1959,8 +1959,10 @@ virConfPtr xenFormatXM(virConnectPtr conn,
                             break;
                         }
                     }
-                    if (xenFormatXMSerial(serialVal, chr) < 0)
+                    if (xenFormatXMSerial(serialVal, chr) < 0) {
+                        virConfFreeValue(serialVal);
                         goto cleanup;
+                    }
                 }
 
                 if (serialVal->list != NULL) {