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

[libvirt] [PATCH 18/23] Avoid uninitialized data in qemuMonitorTestNew



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

The virDomainChrSourceDef variable should be memset to
0, so that the cleanup block does not free uninitialized
data on OOM.

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 tests/qemumonitortestutils.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 9568476..bca3385 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -878,6 +878,8 @@ qemuMonitorTestNew(bool json,
     qemuMonitorTestPtr test = NULL;
     virDomainChrSourceDef src;
 
+    memset(&src, 0, sizeof(src));
+
     if (!(test = qemuMonitorCommonTestNew(xmlopt, vm, &src)))
         goto error;
 
@@ -915,6 +917,8 @@ qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt)
     qemuMonitorTestPtr test = NULL;
     virDomainChrSourceDef src;
 
+    memset(&src, 0, sizeof(src));
+
     if (!(test = qemuMonitorCommonTestNew(xmlopt, NULL, &src)))
         goto error;
 
-- 
1.8.3.1


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