FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

LinkBack Thread Tools
Old 03-10-2009, 07:58 PM
David Cantrell
Default : Do not Py_DECREF imported dm module reference


On 03/05/2009 02:31 PM, Hans de Goede wrote:

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
} while ((s = strtok(NULL, "

- Py_DECREF(m);
return table_list;

- Py_XDECREF(m);
if (!PyErr_Occurred()) {
if (errno != 0)
@@ -883,7 +880,6 @@ pydmraid_raidset_get_map(PyObject *self, void *data)

- Py_XDECREF(m);
if (!map && !PyErr_Occurred()) {
if (errno != 0)

David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

Anaconda-devel-list mailing list

Thread Tools

All times are GMT. The time now is 11:24 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org