[PATCH 0/3] python: Fix memory leaks

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

 



From: Alex Jia <ajia@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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

--
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]