[libvirt] [PATCH 14/17] Fix leak of char device in xenParseXM
Daniel P. Berrange
berrange at redhat.com
Tue Sep 24 16:04:04 UTC 2013
From: "Daniel P. Berrange" <berrange at redhat.com>
If an OOM occurs in xenParseXM, a virDomainChrDef may be
leaked.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
src/xenxs/xen_xm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 1ffea84..4386fef 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -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;
--
1.8.3.1
More information about the libvir-list
mailing list