From 0377238fe8aa7d0a6faf7dbaa9a67c59cd1d58bc Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 24 Sep 2013 16:46:44 +0100 Subject: [PATCH] Fix leak of serial value in xenFormatXM on OOM If an OOM occurs in xenFormatXM when formatting to the serial device value, the value is leaked. Signed-off-by: Daniel P. Berrange --- 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 7550a07abc..9e07f956d2 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -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) {