sjpp / rpms / libvirt-python

Forked from rpms/libvirt-python 3 years ago
Clone
Blob Blame History Raw
From feb429c6829912ea2680bb65ca41f90c90d8cefe Mon Sep 17 00:00:00 2001
Message-Id: <feb429c6829912ea2680bb65ca41f90c90d8cefe@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 2 Sep 2014 14:47:24 +0200
Subject: [PATCH] override: Fix two uninitialized variables in
 convertDomainStatsRecord

py_record_domain and py_record_stats would be accessed uninitialized if
an out-of-memory condition would happen in the first loop. Unlikely, but
coverity complained.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1136354
(cherry picked from commit 23e22c2df148a402a0221c475e139b8ea19fbbd5)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 libvirt-override.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index 17ea042..872e33b 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7963,8 +7963,8 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records,
 {
     PyObject *py_retval;
     PyObject *py_record;
-    PyObject *py_record_domain;
-    PyObject *py_record_stats;
+    PyObject *py_record_domain = NULL;
+    PyObject *py_record_stats = NULL;
     size_t i;
 
     if (!(py_retval = PyList_New(nrecords)))
-- 
2.1.0