[Python-checkins] r68412 - in sandbox/trunk/io-c: _fileio.c _textio.c

amaury.forgeotdarc python-checkins at python.org
Thu Jan 8 22:20:46 CET 2009


Author: amaury.forgeotdarc
Date: Thu Jan  8 22:20:46 2009
New Revision: 68412

Log:
Correct some reference leaks


Modified:
   sandbox/trunk/io-c/_fileio.c
   sandbox/trunk/io-c/_textio.c

Modified: sandbox/trunk/io-c/_fileio.c
==============================================================================
--- sandbox/trunk/io-c/_fileio.c	(original)
+++ sandbox/trunk/io-c/_fileio.c	Thu Jan  8 22:20:46 2009
@@ -337,6 +337,8 @@
 		}
 	}
 
+	Py_CLEAR(self->dict);
+
 	Py_TYPE(self)->tp_free((PyObject *)self);
 }
 

Modified: sandbox/trunk/io-c/_textio.c
==============================================================================
--- sandbox/trunk/io-c/_textio.c	(original)
+++ sandbox/trunk/io-c/_textio.c	Thu Jan  8 22:20:46 2009
@@ -92,6 +92,14 @@
     return 0;
 }
 
+static void
+IncrementalNewlineDecoder_dealloc(PyNewLineDecoderObject *self)
+{
+    Py_CLEAR(self->decoder);
+    Py_CLEAR(self->errors);
+    Py_TYPE(self)->tp_free((PyObject *)self);
+}
+
 #define SEEN_CR   1
 #define SEEN_LF   2
 #define SEEN_CRLF 4
@@ -357,7 +365,7 @@
     "IncrementalNewlineDecoder", /*tp_name*/
     sizeof(PyNewLineDecoderObject), /*tp_basicsize*/
     0,                          /*tp_itemsize*/
-    0,                          /*tp_dealloc*/
+    (destructor)IncrementalNewlineDecoder_dealloc, /*tp_dealloc*/
     0,                          /*tp_print*/
     0,                          /*tp_getattr*/
     0,                          /*tp_setattr*/


More information about the Python-checkins mailing list