[issue18333] Memory leak in _pickle.c:Unpickler_set_memo()

Christian Heimes report at bugs.python.org
Sun Jun 30 19:00:56 CEST 2013


New submission from Christian Heimes:

Unpickler_set_memo() has a memory leak when it is called with an empty dictionariy as argument

- PyDict_Check(obj) is true
- PyDict_Size(obj) returns 0
- _Unpickler_NewMemo(new_memo_size) calls PyMem_MALLOC(0)
- PyMem_MALLOC(0) returns a valid pointer although 0 bytes have been requested
- later on an error occurs: goto exit
- because new_memo_size == 0, PyMem_FREE(new_memo) is never executed

CID 983308 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable "new_memo" going out of scope leaks the storage it points to.

----------
components: Extension Modules
messages: 192079
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: Memory leak in _pickle.c:Unpickler_set_memo()
type: resource usage
versions: Python 3.3, Python 3.4

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


More information about the Python-bugs-list mailing list