[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 17/17] Fix leak of serial value in xenFormatXM on OOM



From: "Daniel P. Berrange" <berrange redhat com>

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 7550a07..9e07f95 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) {
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]