[issue3305] Use Py_XDECREF() instead of Py_DECREF() in MultibyteCodec and MultibyteStreamReader

STINNER Victor report at bugs.python.org
Sun Jul 6 20:27:40 CEST 2008


New submission from STINNER Victor <haypo at users.sourceforge.net>:

Functions mbstreamwriter_dealloc() and mbstreamreader_dealloc() of 
Modules/cjkcodecs/multibytecodec.c uses Py_DECREF() to free stream 
attribute memory, but this attribute may be NULL if MultibyteCodec or 
MultibyteStreamReader constructor fails.

Simple fix: use Py_XDECREF().

Example:
>>> import _multibytecodec
>>> _multibytecodec.MultibyteStreamReader(None)
Erreur de segmentation (core dumped)

----------
components: Library (Lib)
files: multibytecodec_py_xdecref.patch
keywords: patch
messages: 69347
nosy: haypo
severity: normal
status: open
title: Use Py_XDECREF() instead of Py_DECREF() in MultibyteCodec and MultibyteStreamReader
versions: Python 2.6
Added file: http://bugs.python.org/file10834/multibytecodec_py_xdecref.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3305>
_______________________________________


More information about the Python-bugs-list mailing list