PATCH [3/5]: pyblock: Fix map->dev refcounting

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

 



Fix map->dev refcounting.
---
 dm.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dm.c b/dm.c
index cd5110b..42f70a8 100644
--- a/dm.c
+++ b/dm.c
@@ -948,16 +948,14 @@ pydm_map_init_method(PyObject *self, PyObject *args, PyObject *kwds)
 			&PydmDevice_Type, &dev))
 		return -1;

-	Py_XINCREF(dev);
-
 	map->name = strdup(name);

 	if (uuid)
 		map->uuid = strdup(uuid);
-	if (dev)
+	if (dev) {
+		Py_INCREF(dev);
 		map->dev = (PyObject *)dev;
-	
-	Py_XDECREF(dev);
+	}

 	return pydm_map_create(map, table);
 }
@@ -1262,7 +1260,6 @@ pydm_map_get(PyObject *self, void *data)
 		if (!dev) {
 			dev = PydmDevice_FromMajorMinor(0,0);
 			map->dev = dev;
-			Py_INCREF(dev);
 		}
 		Py_INCREF(dev);
 		return dev;
--
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