[PATCH pyblock 1/2]: Do not Py_DECREF imported dm module reference

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

 



It turns out that PyType_GenericNew, does not do a Py_INCREF on the
passed in type, so if we Py_DECREF the reference to the imported dm module
in dmraid.c theoretically the dm module (holding the dm.table type) could
be destroyed from underneath us. We fix this by not Py_DECREF'ing
the imported module after we are done with it.

Note this does mean we leak a reference and the module will never get
destroyed, but we can live with that. Actually we have been doing that
until very recently, when a patch of mine introduced these DECREF's to
being with.
---
 dmraid.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/dmraid.c b/dmraid.c
index 23e1bbc..b397adc 100644
--- a/dmraid.c
+++ b/dmraid.c
@@ -824,15 +824,12 @@ pydmraid_raidset_get_dm_table(PyObject *self, void *data)
 		Py_CLEAR(table);
 	} while ((s = strtok(NULL, "\n")));

-	Py_DECREF(m);
-
 	return table_list;

 out:
 	Py_XDECREF(iret);
 	Py_XDECREF(table);
 	Py_XDECREF(table_list);
-	Py_XDECREF(m);
 	if (!PyErr_Occurred()) {
 		if (errno != 0)
 			PyErr_SetFromErrno(PyExc_SystemError);
@@ -883,7 +880,6 @@ pydmraid_raidset_get_map(PyObject *self, void *data)

 out:
 	Py_XDECREF(iret);
-	Py_XDECREF(m);
 	Py_XDECREF(table);
 	if (!map && !PyErr_Occurred()) {
 		if (errno != 0)
--
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux