Issue 18333: Memory leak in _pickle.c:Unpickler_set_memo() (original) (raw)

Issue18333

Created on 2013-06-30 17:00 by christian.heimes, last changed 2022-04-11 14:57 by admin. 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
2022-04-11 14:57:47 admin set github: 62533
2013-07-01 22:46:53 christian.heimes set status: open -> closedresolution: not a bugmessages: +
2013-06-30 17:00:56 christian.heimes create