classification
Title: Memory leak in _pickle.c:Unpickler_set_memo()
Type: resource usage Stage: needs patch
Components: Extension Modules Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes
Priority: normal Keywords:

Created on 2013-06-30 17:00 by christian.heimes, last changed 2013-07-01 22:46 by christian.heimes. This issue is now closed.

Messages (2)
msg192079 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-06-30 17:00
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.
msg192159 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-01 22:46
After a good night sleep I realized it's a false positive. All gotos are inside the while block. The while block is only entered when PyDict_Size(obj) > 0.
History
Date User Action Args
2013-07-01 22:46:53christian.heimessetstatus: open -> closed
resolution: not a bug
messages: + msg192159
2013-06-30 17:00:56christian.heimescreate