PATCH: pyparted: Do not keep a borrowed refence without INCREF-ing it

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

 



In _ped_Disk_init we store a borrowed reference in self->dev (through
PyArg_ParseTuple()). We INCREF this on success at the end. But we keep it
without INCREF-ing it in an error path. This path clears the borrowed reference
in the error path. This fixes various cases of python crashing when having
an invalid partition table.
---
 src/pydisk.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/pydisk.c b/src/pydisk.c
index 27b8d95..19f7724 100644
--- a/src/pydisk.c
+++ b/src/pydisk.c
@@ -273,6 +273,7 @@ int _ped_Disk_init(_ped_Disk *self, PyObject *args, PyObject *kwds) { PyErr_Format(IOException, "Failed to read partition table from device %s", device->path);
         }

+        self->dev = NULL;
         return -4;
     }

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