New submission from Patrick Miller:

There is a reference counting error in PyFloat_AsDouble.

When the function calls the nb_float conversion, if the method does not return 
an actual float object, an exception is set, but the object is not collected.

--- Objects/floatobject.c       2014-10-08 04:18:15.000000000 -0400
+++ Objects/floatobject.c.patched       2015-03-05 09:17:15.171455648 -0500
@@ -214,6 +214,7 @@
     if (fo == NULL)
         return -1;
     if (!PyFloat_Check(fo)) {
+        Py_DECREF(fo);
         PyErr_SetString(PyExc_TypeError,
                         "nb_float should return float object");
         return -1;

----------
components: Interpreter Core
files: floatobject.c-patch
messages: 237266
nosy: Patrick Miller
priority: normal
severity: normal
status: open
title: Potential leak in PyFloat_AsDouble.  Refcount error.
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file38342/floatobject.c-patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23590>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to