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

[libvirt] [PATCH 0/3] python: Fix memory leaks



From: Alex Jia <ajia redhat com>

This series patches fix memory leaks issues. Detected by valgrind.

Alex Jia (3):
* python/libvirt-override.c: fix memory leaks on libvirt_virDomainBlockStatsFlags.
* python/libvirt-override.c: fix memory leaks on libvirt_virDomainGetSchedulerParameters
  and libvirt_virDomainGetSchedulerParametersFlags.
* python/libvirt-override.c: fix memory leaks on libvirt_virDomainGetMemoryParameters.

Signed-off-by: Alex Jia <ajia redhat com>
---
 python/libvirt-override.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index d2aad0f..a138090 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -176,6 +176,8 @@ libvirt_virDomainBlockStatsFlags(PyObject *self ATTRIBUTE_UNUSED,
 
         key = libvirt_constcharPtrWrap(params[i].field);
         PyDict_SetItem(info, key, val);
+        Py_DECREF(key);
+        Py_DECREF(val);
     }
 
     free(params);
@@ -369,6 +371,8 @@ libvirt_virDomainGetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
 
         key = libvirt_constcharPtrWrap(params[i].field);
         PyDict_SetItem(info, key, val);
+        Py_DECREF(key);
+        Py_DECREF(val);
     }
     free(params);
     return(info);
@@ -451,6 +455,8 @@ libvirt_virDomainGetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
 
         key = libvirt_constcharPtrWrap(params[i].field);
         PyDict_SetItem(info, key, val);
+        Py_DECREF(key);
+        Py_DECREF(val);
     }
     free(params);
     return(info);
@@ -994,6 +1000,8 @@ libvirt_virDomainGetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
 
         key = libvirt_constcharPtrWrap(params[i].field);
         PyDict_SetItem(info, key, val);
+        Py_DECREF(key);
+        Py_DECREF(val);
     }
     free(params);
     return(info);
-- 
1.7.1


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