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

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

If an OOM occurs in xenFormatXM when formatting to the
serial device value, the value is leaked.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]